Conversation
…yboardButtonRequestManagedBot and the field request_managed_bot to the class KeyboardButton.
…o the class Message.
…eir token, represented by the class ManagedBotUpdated and the field managed_bot in the class Update.
…boardButton, allowing bots to request users, chats and managed bots from Mini Apps.
…s in the class Poll.
… persistent identifier for the option.
…e class Message. Added the class PollOptionDeleted and the field poll_option_deleted to the class Message.
… bots to reply to a specific poll option.
… TextQuote, ReplyParameters quote, sendGift, and giftPremiumSubscription.
|
@Badiboy I'm done, you can revidw Please acknowledge that you received this message |
|
@coder2020official I do ) |
|
@coder2020official Do you remember why we have "add" method in "Poll" class? I cannot imagine why and where it can be used as far as Poll is JsonDeserializable only.. |
|
Maybe some time ago InputPollOption never existed, and you would have to use PollOption to copy the poll.. |
|
But now it's irrelevant. To copy the poll copyMessage should be sufficient |
|
@coder2020official |
There was a problem hiding this comment.
Pull request overview
Updates the library’s Telegram Bot API bindings to Bot API 9.6, adding support for “Managed Bots” updates/methods and the expanded Poll API fields.
Changes:
- Added Managed Bots: new types (
ManagedBotUpdated,ManagedBotCreated,KeyboardButtonRequestManagedBot,PreparedKeyboardButton) and new bot methods (getManagedBotToken,replaceManagedBotToken,savePreparedKeyboardButton) plus handler support formanaged_botupdates. - Updated Poll model & sendPoll params for new/changed fields (e.g.,
correct_option_ids,allows_revoting, persistent option IDs, poll option added/deleted service messages). - Bumped README supported Bot API version badge to 9.6 and updated tests/fixtures accordingly.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
telebot/types.py |
Adds new 9.6 types and extends existing models (Update/Message/Poll/etc.). |
telebot/__init__.py |
Adds sync bot support for managed_bot update handlers + new API methods. |
telebot/async_telebot.py |
Adds async bot support for managed_bot update handlers + new API methods. |
telebot/apihelper.py |
Adds sync HTTP helpers for new Bot API 9.6 methods and expanded sendPoll params. |
telebot/asyncio_helper.py |
Adds async HTTP helpers for new Bot API 9.6 methods and expanded sendPoll params. |
telebot/util.py |
Extends service content types for new service messages. |
tests/test_types.py |
Updates poll/poll_answer JSON fixtures to new fields. |
tests/test_telebot.py |
Updates Update construction to include the new managed_bot field. |
tests/test_handler_backends.py |
Updates Update construction argument count to match new signature. |
README.md |
Updates displayed supported Bot API version to 9.6. |
Comments suppressed due to low confidence (2)
telebot/util.py:57
telebot.util.update_typesis used as the canonical list forallowed_updates, but it doesn't include the newmanaged_botupdate type introduced in this PR (while the bot now processesupdate.managed_bot). Add"managed_bot"toupdate_typesso users can enable/disable it consistently.
'suggested_post_paid', 'gift_upgrade_sent', 'chat_owner_left', 'chat_owner_changed', 'managed_bot_created',
'poll_option_added', 'poll_option_deleted'
]
#: All update types, should be used for allowed_updates parameter in polling.
update_types = [
"message", "edited_message", "channel_post", "edited_channel_post", "inline_query", "chosen_inline_result",
"callback_query", "shipping_query", "pre_checkout_query", "poll", "poll_answer", "my_chat_member", "chat_member",
"chat_join_request", "message_reaction", "message_reaction_count", "removed_chat_boost", "chat_boost",
"business_connection", "business_message", "edited_business_message", "deleted_business_messages",
"purchased_paid_media",
]
telebot/types.py:7726
PollAnswer.to_dict()setsjson_dict["voter_chat"] = self.voter_chat, which is aChatobject and not JSON-serializable. This should likely beself.voter_chat.to_dict()(similar to howuseris handled) to avoid runtime errors when callingto_json()/to_dict()withvoter_chatpresent.
def to_dict(self):
# Left for backward compatibility, but with no support for voter_chat
json_dict = {
"poll_id": self.poll_id,
"option_ids": self.option_ids,
"option_persistent_ids": self.option_persistent_ids
}
if self.user:
json_dict["user"] = self.user.to_dict()
if self.voter_chat:
json_dict["voter_chat"] = self.voter_chat
return json_dict
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Regarding some copilot suggestions The API is now always passing persistent_id for polls. People using older versions of the local bot API may not receive persistent_id. Should I make it optional or prioritize the main API? |
I propose not to care about local API servers. It's a bit out of the subject of cbot library. |
|
I checked all CoPilot reviews - I confirm all you applied and all you did not, except one with "post" method. After that I propose to merge! |
|
managed_bot should be added to update_types in util.py |
|
Thank you!! |
Bot API 9.6
Managed Bots
Polls