Bot API 10.0: Chat Management#5230
Conversation
There was a problem hiding this comment.
Pull request overview
Adds Bot API 10.0 “Chat Management” support to the library by introducing new reaction-deletion endpoints, extending admin retrieval to optionally include bots, and adding the new can_react_to_messages permission to relevant objects, along with corresponding test and documentation updates.
Changes:
- Add
delete_message_reaction/delete_all_message_reactionstoBot/ExtBotand new shortcut methods onChat,Message, andUser. - Extend
get_chat_administrators(andChat.get_administrators) with thereturn_botsparameter and adapt tests. - Add
can_react_to_messagestoChatPermissionsandChatMemberRestricted, updating serialization/equality tests and docs.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_user.py | Adds tests for new User reaction deletion shortcuts. |
| tests/test_message.py | Adds tests for new Message.delete_reaction shortcut. |
| tests/test_chatpermissions.py | Updates ChatPermissions tests for can_react_to_messages. |
| tests/test_chatmember.py | Updates ChatMemberRestricted tests for can_react_to_messages. |
| tests/test_chat.py | Adds tests for new Chat reaction deletion shortcuts. |
| tests/test_bot.py | Adds offline request-shape tests for new bot methods; updates get_chat_administrators test to use return_bots. |
| src/telegram/ext/_extbot.py | Plumbs return_bots and adds ExtBot wrappers + camelCase aliases for new endpoints. |
| src/telegram/_user.py | Fixes replace_token return docs; adds User reaction deletion shortcuts. |
| src/telegram/_message.py | Adds Message.delete_reaction shortcut. |
| src/telegram/_chatpermissions.py | Adds can_react_to_messages to model/equality and docs. |
| src/telegram/_chatmember.py | Adds can_react_to_messages to ChatMemberRestricted model/docs (with optional signature). |
| src/telegram/_chat.py | Adds return_bots to Chat.get_administrators; adds reaction deletion shortcuts. |
| src/telegram/_bot.py | Adds return_bots support for get_chat_administrators; adds new reaction deletion endpoints + aliases. |
| docs/source/inclusions/bot_methods.rst | Adds the new bot methods to the quick overview table. |
| changes/unreleased/5229.87PBN4GFkuAaDhhgFwCYkY.toml | Updates the unreleased changelog entry for Bot API 10.0 support. |
Comments suppressed due to low confidence (1)
src/telegram/_bot.py:5154
- The return description still says that the result excludes other bots, but the new
return_botsparameter allows including them. Please update theReturns:text to describe both cases (default omits other bots;return_bots=Trueincludes them).
Returns:
tuple[:class:`telegram.ChatMember`]: On success, returns a tuple of ``ChatMember``
objects that contains information about all chat administrators except
other bots. If the chat is a group or a supergroup and no administrators were
appointed, only the creator will be returned.
aelkheir
left a comment
There was a problem hiding this comment.
Great! just two comments, and a shortcut for CallbackQuery would be nice.
| self.can_send_video_notes: bool = can_send_video_notes | ||
| self.can_send_voice_notes: bool = can_send_voice_notes | ||
| self.can_edit_tag: bool = can_edit_tag | ||
| self.can_react_to_messages: bool | None = can_react_to_messages |
There was a problem hiding this comment.
| self.can_react_to_messages: bool | None = can_react_to_messages | |
| self.can_react_to_messages: bool = can_react_to_messages |
and raising TypeError when missing
| self, | ||
| chat_id: int | str, | ||
| message_id: int, | ||
| actor_chat_id: int | None = None, |
There was a problem hiding this comment.
can actor_chat_id be removed from the signature? or you preferred not to intervene between users and Telegram
There was a problem hiding this comment.
yea I initially didn't have it on there, but then decided to keep it in since Telegram should be the one complaining about it
No description provided.