Skip to content

Bot API 10.0: Chat Management#5230

Open
harshil21 wants to merge 3 commits into
api-10.0-centralfrom
api-10.0-chat-management
Open

Bot API 10.0: Chat Management#5230
harshil21 wants to merge 3 commits into
api-10.0-centralfrom
api-10.0-chat-management

Conversation

@harshil21
Copy link
Copy Markdown
Member

No description provided.

@harshil21 harshil21 added the ⚙️ bot-api affected functionality: bot-api label May 10, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_reactions to Bot/ExtBot and new shortcut methods on Chat, Message, and User.
  • Extend get_chat_administrators (and Chat.get_administrators) with the return_bots parameter and adapt tests.
  • Add can_react_to_messages to ChatPermissions and ChatMemberRestricted, 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_bots parameter allows including them. Please update the Returns: text to describe both cases (default omits other bots; return_bots=True includes 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.

Comment thread src/telegram/_chat.py
Comment thread src/telegram/_chatmember.py
Copy link
Copy Markdown
Member

@aelkheir aelkheir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Comment thread src/telegram/_user.py
self,
chat_id: int | str,
message_id: int,
actor_chat_id: int | None = None,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can actor_chat_id be removed from the signature? or you preferred not to intervene between users and Telegram

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⚙️ bot-api affected functionality: bot-api

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants