diff --git a/CHANGELOG.md b/CHANGELOG.md index b9eedcca..c3c3e5b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,9 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c ## [Unreleased] ### Notes -- [:ledger: View file changes][Unreleased] +- [:ledger: View file changes][Unreleased] ∙ [:page_with_curl: DB migration script][unreleased-sql-migration] ### Added +- Bot API 6.8 (@noplanman) ### Changed ### Deprecated ### Removed @@ -624,6 +625,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c ### Deprecated - Move `hideKeyboard` to `removeKeyboard`. +[unreleased-sql-migration]: https://github.com/php-telegram-bot/core/tree/develop/utils/db-schema-update/0.81.0-unreleased.sql [0.81.0-sql-migration]: https://github.com/php-telegram-bot/core/tree/master/utils/db-schema-update/0.80.0-0.81.0.sql [0.80.0-sql-migration]: https://github.com/php-telegram-bot/core/tree/master/utils/db-schema-update/0.79.0-0.80.0.sql [0.80.0-bc-commands-with-underscores]: https://github.com/php-telegram-bot/core/wiki/Breaking-backwards-compatibility#commands-with-underscores diff --git a/src/DB.php b/src/DB.php index efcc63a3..6472d171 100644 --- a/src/DB.php +++ b/src/DB.php @@ -1136,7 +1136,7 @@ public static function insertMessageRequest(Message $message): bool `id`, `user_id`, `chat_id`, `message_thread_id`, `sender_chat_id`, `date`, `forward_from`, `forward_from_chat`, `forward_from_message_id`, `forward_signature`, `forward_sender_name`, `forward_date`, `is_topic_message`, `reply_to_chat`, `reply_to_message`, `via_bot`, `edit_date`, `media_group_id`, `author_signature`, `text`, `entities`, `caption_entities`, - `audio`, `document`, `animation`, `game`, `photo`, `sticker`, `video`, `voice`, `video_note`, `caption`, `has_media_spoiler`, `contact`, + `audio`, `document`, `animation`, `game`, `photo`, `sticker`, `story`, `video`, `voice`, `video_note`, `caption`, `has_media_spoiler`, `contact`, `location`, `venue`, `poll`, `dice`, `new_chat_members`, `left_chat_member`, `new_chat_title`, `new_chat_photo`, `delete_chat_photo`, `group_chat_created`, `supergroup_chat_created`, `channel_chat_created`, `message_auto_delete_timer_changed`, `migrate_to_chat_id`, `migrate_from_chat_id`, @@ -1147,7 +1147,7 @@ public static function insertMessageRequest(Message $message): bool :message_id, :user_id, :chat_id, :message_thread_id, :sender_chat_id, :date, :forward_from, :forward_from_chat, :forward_from_message_id, :forward_signature, :forward_sender_name, :forward_date, :is_topic_message, :reply_to_chat, :reply_to_message, :via_bot, :edit_date, :media_group_id, :author_signature, :text, :entities, :caption_entities, - :audio, :document, :animation, :game, :photo, :sticker, :video, :voice, :video_note, :caption, :has_media_spoiler, :contact, + :audio, :document, :animation, :game, :photo, :sticker, :story, :video, :voice, :video_note, :caption, :has_media_spoiler, :contact, :location, :venue, :poll, :dice, :new_chat_members, :left_chat_member, :new_chat_title, :new_chat_photo, :delete_chat_photo, :group_chat_created, :supergroup_chat_created, :channel_chat_created, :message_auto_delete_timer_changed, :migrate_to_chat_id, :migrate_from_chat_id, @@ -1202,6 +1202,7 @@ public static function insertMessageRequest(Message $message): bool $sth->bindValue(':game', $message->getGame()); $sth->bindValue(':photo', self::entitiesArrayToJson($message->getPhoto() ?: [])); $sth->bindValue(':sticker', $message->getSticker()); + $sth->bindValue(':story', $message->getStory()); $sth->bindValue(':video', $message->getVideo()); $sth->bindValue(':voice', $message->getVoice()); $sth->bindValue(':video_note', $message->getVideoNote()); diff --git a/src/Entities/Chat.php b/src/Entities/Chat.php index aaccce39..97798243 100644 --- a/src/Entities/Chat.php +++ b/src/Entities/Chat.php @@ -28,6 +28,7 @@ * @method ChatPhoto getPhoto() Optional. Chat photo. Returned only in getChat. * @method string[] getActiveUsernames() Optional. If non-empty, the list of all active chat usernames; for private chats, supergroups and channels. Returned only in getChat. * @method string getEmojiStatusCustomEmojiId() Optional. Custom emoji identifier of emoji status of the other party in a private chat. Returned only in getChat. + * @method int getEmojiStatusExpirationDate() Optional. Expiration date of the emoji status of the other party in a private chat in Unix time, if any. Returned only in getChat. * @method string getBio() Optional. Bio of the other party in a private chat. Returned only in getChat. * @method bool getHasPrivateForwards() Optional. True, if privacy settings of the other party in the private chat allows to use tg://user?id= links only in chats with the user. Returned only in getChat. * @method bool getHasRestrictedVoiceAndVideoMessages() Optional. True, if the privacy settings of the other party restrict sending voice and video note messages in the private chat. Returned only in getChat. diff --git a/src/Entities/Message.php b/src/Entities/Message.php index 6a302e3e..58f36b43 100644 --- a/src/Entities/Message.php +++ b/src/Entities/Message.php @@ -57,6 +57,7 @@ * @method Game getGame() Optional. Message is a game, information about the game. * @method PhotoSize[] getPhoto() Optional. Message is a photo, available sizes of the photo * @method Sticker getSticker() Optional. Message is a sticker, information about the sticker + * @method Story getStory() Optional. Message is a forwarded story * @method Video getVideo() Optional. Message is a video, information about the video * @method Voice getVoice() Optional. Message is a voice message, information about the file * @method VideoNote getVideoNote() Optional. Message is a video note message, information about the video @@ -121,6 +122,7 @@ protected function subEntities(): array 'document' => Document::class, 'photo' => [PhotoSize::class], 'sticker' => Sticker::class, + 'story' => Story::class, 'video' => Video::class, 'video_note' => VideoNote::class, 'voice' => Voice::class, diff --git a/src/Entities/PollAnswer.php b/src/Entities/PollAnswer.php index 8f53df17..f55fe916 100644 --- a/src/Entities/PollAnswer.php +++ b/src/Entities/PollAnswer.php @@ -19,7 +19,8 @@ * @link https://core.telegram.org/bots/api#pollanswer * * @method string getPollId() Unique poll identifier - * @method User getUser() The user, who changed the answer to the poll + * @method Chat getVoterChat() Optional. The chat that changed the answer to the poll, if the voter is anonymous + * @method User getUser() Optional. The user, who changed the answer to the poll * @method array getOptionIds() 0-based identifiers of answer options, chosen by the user. May be empty if the user retracted their vote. */ class PollAnswer extends Entity @@ -30,7 +31,8 @@ class PollAnswer extends Entity protected function subEntities(): array { return [ - 'user' => User::class, + 'voter_chat' => Chat::class, + 'user' => User::class, ]; } } diff --git a/src/Entities/Story.php b/src/Entities/Story.php new file mode 100644 index 00000000..5647db22 --- /dev/null +++ b/src/Entities/Story.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Longman\TelegramBot\Entities; + +/** + * Class Story + * + * @link https://core.telegram.org/bots/api#story + */ +class Story extends Entity +{ + +} diff --git a/src/Request.php b/src/Request.php index f756ccc7..04134f7c 100644 --- a/src/Request.php +++ b/src/Request.php @@ -94,6 +94,7 @@ * @method static ServerResponse reopenGeneralForumTopic(array $data) Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically unhidden if it was hidden. Returns True on success. * @method static ServerResponse hideGeneralForumTopic(array $data) Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically closed if it was open. Returns True on success. * @method static ServerResponse unhideGeneralForumTopic(array $data) Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success. + * @method static ServerResponse unpinAllGeneralForumTopicMessages(array $data) Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success. * @method static ServerResponse answerCallbackQuery(array $data) Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned. * @method static ServerResponse answerInlineQuery(array $data) Use this method to send answers to an inline query. On success, True is returned. * @method static ServerResponse setMyCommands(array $data) Use this method to change the list of the bot's commands. Returns True on success. @@ -269,6 +270,7 @@ class Request 'reopenGeneralForumTopic', 'hideGeneralForumTopic', 'unhideGeneralForumTopic', + 'unpinAllGeneralForumTopicMessages', 'answerCallbackQuery', 'answerInlineQuery', 'setMyCommands', diff --git a/structure.sql b/structure.sql index 52b2701c..205dadec 100644 --- a/structure.sql +++ b/structure.sql @@ -102,6 +102,7 @@ CREATE TABLE IF NOT EXISTS `message` ( `game` TEXT COMMENT 'Game object. Message is a game, information about the game', `photo` TEXT COMMENT 'Array of PhotoSize objects. Message is a photo, available sizes of the photo', `sticker` TEXT COMMENT 'Sticker object. Message is a sticker, information about the sticker', + `story` TEXT COMMENT 'Story object. Message is a forwarded story', `video` TEXT COMMENT 'Video object. Message is a video, information about the video', `voice` TEXT COMMENT 'Voice Object. Message is a Voice, information about the Voice', `video_note` TEXT COMMENT 'VoiceNote Object. Message is a Video Note, information about the Video Note', diff --git a/utils/db-schema-update/0.81.0-unreleased.sql b/utils/db-schema-update/0.81.0-unreleased.sql new file mode 100644 index 00000000..bae194cb --- /dev/null +++ b/utils/db-schema-update/0.81.0-unreleased.sql @@ -0,0 +1,2 @@ +ALTER TABLE `message` + ADD COLUMN `story` TEXT DEFAULT NULL COMMENT 'Story object. Message is a forwarded story' AFTER `sticker`;