Skip to content

Bot API 10.0: Chat Management#5230

Merged
harshil21 merged 7 commits into
api-10.0-centralfrom
api-10.0-chat-management
May 20, 2026
Merged

Bot API 10.0: Chat Management#5230
harshil21 merged 7 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.

Comment thread src/telegram/_chatmember.py Outdated
Comment thread src/telegram/_user.py
@harshil21 harshil21 requested review from aelkheir and removed request for aelkheir May 16, 2026 07:09
@harshil21
Copy link
Copy Markdown
Member Author

Not sure if the CallbackQuery shortcut for removing a reaction on a message would be useful, what use case are you thinking of?

A user could always remove their own reaction from the message directly instead of using a inline keyboard button.

@aelkheir
Copy link
Copy Markdown
Member

The same regular usecase that exist in Message but when the developer is dealing with a callback_query update.

They can still do callback_query.message.delete_{all,message}reaction(s) but they wouldn't get code completion from my experience

A user could always remove their own reaction from the message directly instead of using a inline keyboard button.

Maybe a reset reactions button for group/channel admins but not necessarily. For me its more about the code completion if/when needed

@harshil21 harshil21 requested a review from aelkheir May 16, 2026 12:00
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.

apologies i had these comments pending for days and thought they were delivered. i forgot how to use github apparently

Comment thread src/telegram/_user.py
Comment thread src/telegram/_chatmember.py Outdated
Comment thread src/telegram/_callbackquery.py Outdated
@harshil21 harshil21 requested a review from aelkheir May 19, 2026 08:34
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.

LGTM!

@harshil21 harshil21 merged commit 1b1dd48 into api-10.0-central May 20, 2026
25 of 27 checks passed
@harshil21 harshil21 deleted the api-10.0-chat-management branch May 20, 2026 19:37
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