Add support for Bot API version 9.5#2566
Conversation
…r tags, date_time entity)
There was a problem hiding this comment.
Pull request overview
Adds Telegram Bot API 9.5 support across types, sync/async clients, helpers, tests, and examples to keep the library aligned with the latest API surface.
Changes:
- Extend core types with Bot API 9.5 fields (e.g.,
MessageEntity.date_time, sender/member tag fields, new permissions/rights flags). - Add new helper/client methods (
setChatMemberTag) and support new promotion flag (can_manage_tags) inpromoteChatMember(sync + async). - Update/expand unit tests and examples; bump README supported Bot API version badge/link.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
telebot/types.py |
Adds new 9.5 fields on message entities, messages, chat members, permissions, and admin rights. |
telebot/apihelper.py |
Adds set_chat_member_tag and can_manage_tags support to promote_chat_member. |
telebot/asyncio_helper.py |
Async equivalents for set_chat_member_tag and promote_chat_member(can_manage_tags=...). |
telebot/__init__.py |
Exposes new/updated APIs on the synchronous TeleBot client. |
telebot/async_telebot.py |
Exposes new/updated APIs on the async client and updates docstrings. |
tests/test_types.py |
Adds unit tests for new 9.5 fields across types. |
tests/test_apihelper_95.py |
Adds unit tests for new helper params/methods (can_manage_tags, set_chat_member_tag). |
examples/send_message_draft_example.py |
New sync example for send_message_draft. |
examples/asynchronous_telebot/send_message_draft_example.py |
New async example for send_message_draft. |
examples/formatting_example.py |
Adds a date_time entity usage example (sync). |
examples/asynchronous_telebot/formatting_example.py |
Adds a date_time entity usage example (async). |
examples/chat_member_example.py |
Adds a set_tag command example (sync). |
examples/asynchronous_telebot/chat_member_example.py |
Adds a set_tag command example (async). |
README.md |
Updates supported Bot API version badge/link to 9.5. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thank you, we'll review in the nearest days. |
|
Hi! 👋 Just a gentle follow-up on this PR. Thanks for your time! |
telebot/__init__.py
Outdated
| :return: True on success. | ||
| :rtype: :obj:`bool` | ||
| """ | ||
| return apihelper.set_chat_member_tag(self.token, chat_id, user_id, tag) |
There was a problem hiding this comment.
Better pass optional parameters using parameter names; tag=tag
|
Otherwise lgtm. No opinion on the new tests implemented |
Thanks for the review! I've updated the code to pass the optional parameter as a named argument. |
Description
Include changes, new features and etc:
MessageEntitytypedate_timewith fieldsunix_timeanddate_time_format.sendMessageDraftsupport for both sync and async clients/helpers.tagtoChatMemberMemberandChatMemberRestricted.setChatMemberTagmethod for both sync and async clients/helpers.can_edit_tagtoChatMemberRestrictedandChatPermissions.can_manage_tagstoChatMemberAdministratorandChatAdministratorRights.can_manage_tagsparameter support inpromoteChatMember(sync + async).sender_tagsupport inMessage.MessageEntity.unix_timedocstring wording to match Bot API spec (Unix time associated with the entity).BottomButton.iconCustomEmojiIdin this PR.Describe your tests
How did you test your change?
tests/test_types.py:test_message_entity_date_timetest_message_sender_tagtest_chat_member_member_tagtest_chat_member_restricted_tag_and_can_edit_tagtest_chat_member_administrator_can_manage_tagstest_chat_permissions_can_edit_tagtest_chat_administrator_rights_can_manage_tagstests/test_apihelper_95.py:test_promote_chat_member_can_manage_tagstest_set_chat_member_tagtelebot/__init__.py,telebot/async_telebot.py,telebot/apihelper.py,telebot/asyncio_helper.py).Python version: 3.12
OS: Windows 11
Checklist: