diff --git a/CHANGELOG.md b/CHANGELOG.md index df540ce9..6af7076e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,9 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c ## [Unreleased] ### Notes - [:ledger: View file changes][Unreleased] +- 64 bit PHP installs are required to handle files larger than 2GB! ### Added +- Bot API 6.1 (@jyxjjj, @OxMohsen, @noplanman) (#1333, #1338, #1339) ### Changed ### Deprecated ### Removed diff --git a/src/DB.php b/src/DB.php index 6953c2d8..7ff97783 100644 --- a/src/DB.php +++ b/src/DB.php @@ -421,16 +421,18 @@ public static function insertUser(User $user, ?string $date = null, ?Chat $chat try { $sth = self::$pdo->prepare(' INSERT INTO `' . TB_USER . '` - (`id`, `is_bot`, `username`, `first_name`, `last_name`, `language_code`, `created_at`, `updated_at`) + (`id`, `is_bot`, `username`, `first_name`, `last_name`, `language_code`, `is_premium`, `added_to_attachment_menu`, `created_at`, `updated_at`) VALUES - (:id, :is_bot, :username, :first_name, :last_name, :language_code, :created_at, :updated_at) + (:id, :is_bot, :username, :first_name, :last_name, :language_code, :is_premium, :added_to_attachment_menu, :created_at, :updated_at) ON DUPLICATE KEY UPDATE - `is_bot` = VALUES(`is_bot`), - `username` = VALUES(`username`), - `first_name` = VALUES(`first_name`), - `last_name` = VALUES(`last_name`), - `language_code` = VALUES(`language_code`), - `updated_at` = VALUES(`updated_at`) + `is_bot` = VALUES(`is_bot`), + `username` = VALUES(`username`), + `first_name` = VALUES(`first_name`), + `last_name` = VALUES(`last_name`), + `language_code` = VALUES(`language_code`), + `is_premium` = VALUES(`is_premium`), + `added_to_attachment_menu` = VALUES(`added_to_attachment_menu`), + `updated_at` = VALUES(`updated_at`) '); $sth->bindValue(':id', $user->getId()); @@ -439,6 +441,8 @@ public static function insertUser(User $user, ?string $date = null, ?Chat $chat $sth->bindValue(':first_name', $user->getFirstName()); $sth->bindValue(':last_name', $user->getLastName()); $sth->bindValue(':language_code', $user->getLanguageCode()); + $sth->bindValue(':is_premium', $user->getIsPremium(), PDO::PARAM_INT); + $sth->bindValue(':added_to_attachment_menu', $user->getAddedToAttachmentMenu(), PDO::PARAM_INT); $date = $date ?: self::getTimestamp(); $sth->bindValue(':created_at', $date); $sth->bindValue(':updated_at', $date); diff --git a/structure.sql b/structure.sql index e4ce0052..b0ec6bf6 100644 --- a/structure.sql +++ b/structure.sql @@ -5,6 +5,8 @@ CREATE TABLE IF NOT EXISTS `user` ( `last_name` CHAR(255) DEFAULT NULL COMMENT 'User''s or bot''s last name', `username` CHAR(191) DEFAULT NULL COMMENT 'User''s or bot''s username', `language_code` CHAR(10) DEFAULT NULL COMMENT 'IETF language tag of the user''s language', + `is_premium` tinyint(1) DEFAULT 0 COMMENT 'True, if this user is a Telegram Premium user', + `added_to_attachment_menu` tinyint(1) DEFAULT 0 COMMENT 'True, if this user added the bot to the attachment menu', `created_at` timestamp NULL DEFAULT NULL COMMENT 'Entry date creation', `updated_at` timestamp NULL DEFAULT NULL COMMENT 'Entry date update', diff --git a/utils/db-schema-update/0.77.1-unreleased.sql b/utils/db-schema-update/0.77.1-unreleased.sql new file mode 100644 index 00000000..370ee6f7 --- /dev/null +++ b/utils/db-schema-update/0.77.1-unreleased.sql @@ -0,0 +1,2 @@ +ALTER TABLE `user` ADD COLUMN `is_premium` tinyint(1) DEFAULT 0 COMMENT 'True, if this user is a Telegram Premium user' AFTER `language_code`; +ALTER TABLE `user` ADD COLUMN `added_to_attachment_menu` tinyint(1) DEFAULT 0 COMMENT 'True, if this user added the bot to the attachment menu' AFTER `is_premium`;