Skip to content

Commit 66ca9ea

Browse files
authored
Merge pull request #2581 from coder2020official/master
Bot API 9.6
2 parents d2f9b7a + bf8d739 commit 66ca9ea

File tree

10 files changed

+764
-71
lines changed

10 files changed

+764
-71
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<p align="center">A simple, but extensible Python implementation for the <a href="https://core.telegram.org/bots/api">Telegram Bot API</a>.</p>
1111
<p align="center">Both synchronous and asynchronous.</p>
1212

13-
## <p align="center">Supported Bot API version: <a href="https://core.telegram.org/bots/api#march-1-2026"><img src="https://img.shields.io/badge/Bot%20API-9.5-blue?logo=telegram" alt="Supported Bot API version"></a>
13+
## <p align="center">Supported Bot API version: <a href="https://core.telegram.org/bots/api-changelog#april-3-2026"><img src="https://img.shields.io/badge/Bot%20API-9.6-blue?logo=telegram" alt="Supported Bot API version"></a>
1414

1515
<h2><a href='https://pytba.readthedocs.io/en/latest/index.html'>Official documentation</a></h2>
1616
<h2><a href='https://pytba.readthedocs.io/ru/latest/index.html'>Official ru documentation</a></h2>

telebot/__init__.py

Lines changed: 164 additions & 11 deletions
Large diffs are not rendered by default.

telebot/apihelper.py

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,6 +1606,16 @@ def get_business_connection(token, business_connection_id):
16061606
payload = {'business_connection_id': business_connection_id}
16071607
return _make_request(token, method_url, params=payload , method='post')
16081608

1609+
def get_managed_bot_token(token, user_id):
1610+
method_url = 'getManagedBotToken'
1611+
payload = {'user_id': user_id}
1612+
return _make_request(token, method_url, params=payload , method='post')
1613+
1614+
def replace_managed_bot_token(token, user_id):
1615+
method_url = 'replaceManagedBotToken'
1616+
payload = {'user_id': user_id}
1617+
return _make_request(token, method_url, params=payload , method='post')
1618+
16091619
def delete_my_commands(token, scope=None, language_code=None):
16101620
method_url = r'deleteMyCommands'
16111621
payload = {}
@@ -2486,6 +2496,12 @@ def save_prepared_inline_message(token, user_id, result: types.InlineQueryResult
24862496
return _make_request(token, method_url, params=payload, method='post')
24872497

24882498

2499+
def save_prepared_keyboard_button(token, user_id, button):
2500+
method_url = 'savePreparedKeyboardButton'
2501+
payload = {'user_id': user_id, 'button': button.to_json()}
2502+
return _make_request(token, method_url, params=payload, method='post')
2503+
2504+
24892505
def create_invoice_link(token, title, description, payload, provider_token,
24902506
currency, prices, max_tip_amount=None, suggested_tip_amounts=None, provider_data=None,
24912507
photo_url=None, photo_size=None, photo_width=None, photo_height=None, need_name=None, need_phone_number=None,
@@ -2534,11 +2550,12 @@ def create_invoice_link(token, title, description, payload, provider_token,
25342550
# noinspection PyShadowingBuiltins
25352551
def send_poll(
25362552
token, chat_id, question, options,
2537-
is_anonymous = None, type = None, allows_multiple_answers = None, correct_option_id = None, explanation = None,
2553+
is_anonymous = None, type = None, allows_multiple_answers = None, explanation = None,
25382554
explanation_parse_mode=None, open_period = None, close_date = None, is_closed = None, disable_notification=False,
25392555
reply_markup=None, timeout=None, explanation_entities=None, protect_content=None, message_thread_id=None,
25402556
reply_parameters=None, business_connection_id=None, question_parse_mode=None, question_entities=None, message_effect_id=None,
2541-
allow_paid_broadcast=None):
2557+
allow_paid_broadcast=None, allows_revoting=None, shuffle_options=None, allow_adding_options=None, hide_results_until_closes=None,
2558+
correct_option_ids=None, description=None, description_parse_mode=None, description_entities=None):
25422559
method_url = r'sendPoll'
25432560
payload = {
25442561
'chat_id': str(chat_id),
@@ -2552,8 +2569,6 @@ def send_poll(
25522569
payload['type'] = type
25532570
if allows_multiple_answers is not None:
25542571
payload['allows_multiple_answers'] = allows_multiple_answers
2555-
if correct_option_id is not None:
2556-
payload['correct_option_id'] = correct_option_id
25572572
if explanation:
25582573
payload['explanation'] = explanation
25592574
if explanation_parse_mode:
@@ -2591,6 +2606,22 @@ def send_poll(
25912606
payload['message_effect_id'] = message_effect_id
25922607
if allow_paid_broadcast is not None:
25932608
payload['allow_paid_broadcast'] = allow_paid_broadcast
2609+
if allows_revoting is not None:
2610+
payload['allows_revoting'] = allows_revoting
2611+
if shuffle_options is not None:
2612+
payload['shuffle_options'] = shuffle_options
2613+
if allow_adding_options is not None:
2614+
payload['allow_adding_options'] = allow_adding_options
2615+
if hide_results_until_closes is not None:
2616+
payload['hide_results_until_closes'] = hide_results_until_closes
2617+
if correct_option_ids is not None:
2618+
payload['correct_option_ids'] = json.dumps(correct_option_ids)
2619+
if description is not None:
2620+
payload['description'] = description
2621+
if description_parse_mode is not None:
2622+
payload['description_parse_mode'] = description_parse_mode
2623+
if description_entities is not None:
2624+
payload['description_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(description_entities))
25942625
return _make_request(token, method_url, params=payload)
25952626

25962627
def create_forum_topic(token, chat_id, name, icon_color=None, icon_custom_emoji_id=None):

0 commit comments

Comments
 (0)