Repository navigation
Bot API 10.4 update - #2655
Open
Brian-1812 wants to merge 8 commits into
Open
Bot API 10.4 update#2655Brian-1812 wants to merge 8 commits into
Brian-1812 wants to merge 8 commits into
Conversation
Add the widget part of Bot API 10.4: - types Widget, WidgetQuery, SharedWidgetQuery, WidgetQueryType (data, sign_data, sent_transaction), WidgetQueryWallet, InputWidgetMessageContent and InputSharedWidgetMessageContent; - TonWalletCard, TonWalletCardSticker, TonNft and TonNftAttribute, because WidgetQueryTypeData.wallet_card uses them; - Message.widget, ExternalReplyInfo.widget, Update.widget_query and Update.shared_widget_query; - send_widget, send_shared_widget, answer_widget_query, edit_message_widget_data and edit_shared_widget_data, sync and async; - widget_query_handler and shared_widget_query_handler, sync and async. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add the parts of Bot API 10.4 that are not widgets: - ephemeral replies to callback queries: chat_id of the 14 send methods and EphemeralMessageParameters.receiver_user_id are optional now; a None chat_id is not sent; - TextQuote.rich_texts and ReplyParameters.quote_rich_texts; - TonWalletTransfer, Message.ton_wallet_transfer and ChatFullInfo.ton_wallet_card; - StoryAreaPosition is now AreaPosition; the old name stays as a deprecated subclass; - ChatShareTheme (emoji, unique_gift), EmojiType (emoji, custom_emoji), ChatShareThemeBackdrop(s), ChatFullInfo.share_theme and get_chat_share_theme_backdrops; - get_unique_gift and delete_business_account_gift; - RichTextTonAddress, PaidMessagesWaived and Message.paid_messages_waived; - custom_description_parse_mode and custom_description_entities in verify_user and verify_chat; - doc text for the new MessageEntity types and suggested_username; - README: Bot API 10.4. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- types: each :param description is on one line, like the other classes; - answer_widget_query: use the API method names, as in the API text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- types: each :param description is on one line, like the other classes; - answer_widget_query: use the API method names, as in the API text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- verify_user, verify_chat: the new parameters are marked "Optional.", like the parameters added in the Bot API 10.3 update; - types: each :param description is on one line, like the other classes; - tests: remove the two TeleBot/AsyncTeleBot tests that repeat the apihelper and types tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Active issues break compatibility with existing Update constructor calls, cause media handlers to skip widget messages, and make TON-address deserialization fail when the type field is present.
3 open issues
What changed in this PR
Extends pyTelegramBotAPI’s synchronous and asynchronous clients with the remaining Bot API 10.4 features, building on the widget support from #2654.
Changes:
- Supports ephemeral callback replies without
chat_id, rich quotes, TON wallet data, share themes, gift operations, and verification formatting. - Includes widget types, methods, and query handlers from the underlying PR.
- Adds parsing, payload, and handler tests; updates API documentation and the supported-version badge.
| File | Description |
|---|---|
tests/test_types.py |
Tests new types, parsing, and serialization. |
tests/test_telebot.py |
Tests synchronous widget handlers and updates fixtures. |
tests/test_handler_backends.py |
Updates fixtures for widget query fields. |
tests/test_async_telebot.py |
Tests asynchronous widget handlers. |
tests/test_apihelper_95.py |
Tests new request payloads and omitted chat IDs. |
telebot/util.py |
Registers new service and update types. |
telebot/types.py |
Adds API models, fields, and serialization support. |
telebot/asyncio_helper.py |
Implements asynchronous request payload changes. |
telebot/async_telebot.py |
Exposes asynchronous methods and widget handlers. |
telebot/apihelper.py |
Implements synchronous request payload changes. |
telebot/__init__.py |
Exposes synchronous methods and widget handlers. |
README.md |
Updates the supported Bot API badge to 10.4. |
Review effort: Balanced
| 'suggested_post_paid', 'gift_upgrade_sent', 'chat_owner_left', 'chat_owner_changed', 'managed_bot_created', | ||
| 'poll_option_added', 'poll_option_deleted', 'community_chat_added', 'community_chat_removed', | ||
| 'community_chat_joined' | ||
| 'community_chat_joined', 'ton_wallet_transfer', 'paid_messages_waived' |
Collaborator
There was a problem hiding this comment.
Actual. Both proposal and included comment.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
|
Updated: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
The rest of Bot API 10.4. This PR is built on #2654 (widgets), so until that one merges it shows both commits. Only the last commit, "Bot API 10.4: remaining sections", is new here.
chat_idof the 14 send methods andEphemeralMessageParameters.receiver_user_idare optional. Passchat_id=None; it is not sent.TextQuote.rich_texts,ReplyParameters.quote_rich_texts.TonWalletTransfer,Message.ton_wallet_transfer,ChatFullInfo.ton_wallet_card.StoryAreaPositionis nowAreaPosition; the old name still works and logs a deprecation warning.ChatShareTheme,EmojiType, backdrops,ChatFullInfo.share_theme,get_chat_share_theme_backdrops.get_unique_gift,delete_business_account_gift.RichTextTonAddress,PaidMessagesWaived, newverify_user/verify_chatparameters, doc updates. README badge is 10.4.chat_idstays the first positional argument, so it has no default. An ephemeral reply isbot.send_message(None, "text", ephemeral_message_parameters=...). Happy to change this if you prefer another shape.Describe your tests
New unit tests parse doc-shaped JSON and check the request payloads, sync and async.
cd tests && py.test: 339 passed, 73 skipped. I also ran all 14 send methods withchat_id=Noneagainst a local fake Bot API server: none of them sentchat_id. Not tested against the live API.Python version: 3.12.2
OS: macOS 26.1
Checklist:
🤖 Generated with Claude Code