From 3ea3296844b189f15611483736d182ed110438dd Mon Sep 17 00:00:00 2001 From: Tii Date: Sat, 11 Dec 2021 15:53:11 +0100 Subject: [PATCH 1/7] Added the methods banChatSenderChat and unbanChatSenderChat for banning and unbanning channel chats in supergroups and channels. --- src/Request.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Request.php b/src/Request.php index f81c6daf..777a67c1 100644 --- a/src/Request.php +++ b/src/Request.php @@ -59,6 +59,8 @@ * @method static ServerResponse restrictChatMember(array $data) Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights. Pass True for all permissions to lift restrictions from a user. Returns True on success. * @method static ServerResponse promoteChatMember(array $data) Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Pass False for all boolean parameters to demote a user. Returns True on success. * @method static ServerResponse setChatAdministratorCustomTitle(array $data) Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns True on success. + * @method static ServerResponse banChatSenderChat(array $data) Use this method to ban a channel chat in a supergroup or a channel. Until the chat is unbanned, the owner of the banned chat won't be able to send messages on behalf of any of their channels. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns True on success. + * @method static ServerResponse unbanChatSenderChat(array $data) Use this method to unban a previously banned channel chat in a supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights. Returns True on success. * @method static ServerResponse setChatPermissions(array $data) Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members admin rights. Returns True on success. * @method static ServerResponse exportChatInviteLink(array $data) Use this method to generate a new invite link for a chat. Any previously generated link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns the new invite link as String on success. * @method static ServerResponse createChatInviteLink(array $data) Use this method to create an additional invite link for a chat. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. The link can be revoked using the method revokeChatInviteLink. Returns the new invite link as ChatInviteLink object. From 4e6034d9a3354404e9ddf378ad455affb89d4242 Mon Sep 17 00:00:00 2001 From: Tii Date: Sat, 11 Dec 2021 15:55:46 +0100 Subject: [PATCH 2/7] Added the field has_private_forwards to the Chat entity --- src/Entities/Chat.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Entities/Chat.php b/src/Entities/Chat.php index 6696e1d0..6113c332 100644 --- a/src/Entities/Chat.php +++ b/src/Entities/Chat.php @@ -26,6 +26,7 @@ * @method string getLastName() Optional. Last name of the other party in a private chat * @method ChatPhoto getPhoto() Optional. Chat photo. 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 string getDescription() Optional. Description, for groups, supergroups and channel chats. Returned only in getChat. * @method string getInviteLink() Optional. Chat invite link, for groups, supergroups and channel chats. Each administrator in a chat generates their own invite links, so the bot must first generate the link using exportChatInviteLink. Returned only in getChat. * @method Message getPinnedMessage() Optional. Pinned message, for groups, supergroups and channels. Returned only in getChat. From fa91d99cc5c11744b5143a73d6a9315a0dad8139 Mon Sep 17 00:00:00 2001 From: Tii Date: Sat, 11 Dec 2021 16:01:26 +0100 Subject: [PATCH 3/7] Added the field has_protected_content to the Chat and Message entities. --- src/Entities/Chat.php | 1 + src/Entities/Message.php | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Entities/Chat.php b/src/Entities/Chat.php index 6113c332..44a7dad7 100644 --- a/src/Entities/Chat.php +++ b/src/Entities/Chat.php @@ -32,6 +32,7 @@ * @method Message getPinnedMessage() Optional. Pinned message, for groups, supergroups and channels. Returned only in getChat. * @method ChatPermissions getPermissions() Optional. Default chat member permissions, for groups and supergroups. Returned only in getChat. * @method int getSlowModeDelay() Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user. Returned only in getChat. + * @method bool getHasProtectedContent() Optional. True, if messages from the chat can't be forwarded to other chats. Returned only in getChat. * @method string getStickerSetName() Optional. For supergroups, name of group sticker set. Returned only in getChat. * @method bool getCanSetStickerSet() Optional. True, if the bot can change the group sticker set. Returned only in getChat. * @method int getLinkedChatId() Optional. Unique identifier for the linked chat. Returned only in getChat. diff --git a/src/Entities/Message.php b/src/Entities/Message.php index ea6eeea5..1624bc3e 100644 --- a/src/Entities/Message.php +++ b/src/Entities/Message.php @@ -37,6 +37,7 @@ * @method ReplyToMessage getReplyToMessage() Optional. For replies, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply. * @method User getViaBot() Optional. Bot through which the message was sent * @method int getEditDate() Optional. Date the message was last edited in Unix time + * @method bool getHasProtectedContent() Optional. True, if the message can't be forwarded * @method string getMediaGroupId() Optional. The unique identifier of a media message group this message belongs to * @method string getAuthorSignature() Optional. Signature of the post author for messages in channels * @method MessageEntity[] getEntities() Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text From bbebca6095348b7f938cb8e2b51f99b6cb06784d Mon Sep 17 00:00:00 2001 From: Tii Date: Sat, 11 Dec 2021 16:02:32 +0100 Subject: [PATCH 4/7] Added the field is_automatic_forward to the Message entity. --- src/Entities/Message.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Entities/Message.php b/src/Entities/Message.php index 1624bc3e..25a64006 100644 --- a/src/Entities/Message.php +++ b/src/Entities/Message.php @@ -34,6 +34,7 @@ * @method string getForwardSignature() Optional. For messages forwarded from channels, signature of the post author if present * @method string getForwardSenderName() Optional. Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages * @method int getForwardDate() Optional. For forwarded messages, date the original message was sent in Unix time + * @method bool getIsAutomaticForward() Optional. True, if the message is a channel post that was automatically forwarded to the connected discussion group * @method ReplyToMessage getReplyToMessage() Optional. For replies, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply. * @method User getViaBot() Optional. Bot through which the message was sent * @method int getEditDate() Optional. Date the message was last edited in Unix time From 13bd15640afcd43d00ba45e0bc0d6e8b45dcb274 Mon Sep 17 00:00:00 2001 From: Tii Date: Sat, 11 Dec 2021 16:11:48 +0100 Subject: [PATCH 5/7] Missing message_auto_delete_time field in Chat Entity. (Undocumented Change in Bot API Changelog, but probably added with Bot API 5.1) --- src/Entities/Chat.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Entities/Chat.php b/src/Entities/Chat.php index 44a7dad7..0bd3af40 100644 --- a/src/Entities/Chat.php +++ b/src/Entities/Chat.php @@ -32,6 +32,7 @@ * @method Message getPinnedMessage() Optional. Pinned message, for groups, supergroups and channels. Returned only in getChat. * @method ChatPermissions getPermissions() Optional. Default chat member permissions, for groups and supergroups. Returned only in getChat. * @method int getSlowModeDelay() Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user. Returned only in getChat. + * @method int getMessageAutoDeleteTime() Optional. The time after which all messages sent to the chat will be automatically deleted; in seconds. Returned only in getChat. * @method bool getHasProtectedContent() Optional. True, if messages from the chat can't be forwarded to other chats. Returned only in getChat. * @method string getStickerSetName() Optional. For supergroups, name of group sticker set. Returned only in getChat. * @method bool getCanSetStickerSet() Optional. True, if the bot can change the group sticker set. Returned only in getChat. From d52c967a9e9669c04fa10b2f02960270c371a459 Mon Sep 17 00:00:00 2001 From: Tii Date: Sat, 11 Dec 2021 16:40:18 +0100 Subject: [PATCH 6/7] Added banChatSenderChat and unbanChatSenderChat to actions array --- src/Request.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Request.php b/src/Request.php index 777a67c1..0c7e71a6 100644 --- a/src/Request.php +++ b/src/Request.php @@ -203,6 +203,8 @@ class Request 'restrictChatMember', 'promoteChatMember', 'setChatAdministratorCustomTitle', + 'banChatSenderChat', + 'unbanChatSenderChat', 'setChatPermissions', 'exportChatInviteLink', 'createChatInviteLink', From 2492a1fb518b4939dd53916c2fe2d4adcf837c6f Mon Sep 17 00:00:00 2001 From: Tii Date: Sat, 11 Dec 2021 16:45:26 +0100 Subject: [PATCH 7/7] Added info to changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e8a01da9..74ed91c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,9 +7,12 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c ### Notes - [:ledger: View file changes][Unreleased] ∙ [:page_with_curl: DB migration script][unreleased-sql-migration] ### Added +- Bot API 5.4. (@TiiFuchs, @noplanman) (#1266) +- Bot API 5.5. (@TiiFuchs, @noplanman) (#1267) ### Changed ### Deprecated ### Removed +- [:exclamation:][unreleased-bc-removed-chatactions] Removed ChatAction::RECORD_AUDIO and ChatAction::UPLOAD_AUDIO since it is deprecated for a while now. Use RECORD_VOICE and UPLOAD_VOICE instead. ### Fixed ### Security @@ -538,6 +541,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c - Move `hideKeyboard` to `removeKeyboard`. [unreleased-sql-migration]: # +[unreleased-bc-removed-chatactions]: https://github.com/php-telegram-bot/core/wiki/Breaking-backwards-compatibility#removed-deprecated-chatactions [0.74.0-bc-chatmember-subentities]: https://github.com/php-telegram-bot/core/wiki/Breaking-backwards-compatibility#chatmember-subentities [0.73.0-sql-migration]: https://github.com/php-telegram-bot/core/tree/master/utils/db-schema-update/0.72.0-0.73.0.sql [0.72.0-sql-migration]: https://github.com/php-telegram-bot/core/tree/master/utils/db-schema-update/0.71.0-0.72.0.sql