Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2c2f7bb
Added the field supports_guest_queries to the class User.
coder2020official May 10, 2026
d19162b
Added the fields guest_bot_caller_user and guest_bot_caller_chat to t…
coder2020official May 10, 2026
1107385
Added the field guest_query_id to the class Message.
coder2020official May 10, 2026
13f3dec
Added the field guest_message to the class Update.
coder2020official May 10, 2026
82d466d
Added the class SentGuestMessage and the method answerGuestQuery.
coder2020official May 10, 2026
2a0aa5d
Added the field can_react_to_messages to the classes ChatMemberRestr…
coder2020official May 10, 2026
abb6663
Added the parameter return_bots to the method getChatAdministrators.
coder2020official May 10, 2026
7aede1a
Added the methods deleteAllMessageReactions and deleteMessageReaction
coder2020official May 10, 2026
0cc0e2c
Added the classes InputMediaSticker, InputMediaLocation, and InputMe…
coder2020official May 10, 2026
5981b24
Added the class PollMedia, representing a media in a poll.
coder2020official May 10, 2026
5dbf1c1
Added the field media to the class Poll, allowing bots to see media …
coder2020official May 10, 2026
81e2c5e
Added fields explanation_media, members_only, and country_codes to Poll
coder2020official May 10, 2026
4344145
Added the field media to the class PollOption, allowing bots to see …
coder2020official May 10, 2026
d2f5052
Added InputPollMedia and InputPollOptionMedia
coder2020official May 10, 2026
8f0ddb1
Added media to InputPollOption
coder2020official May 10, 2026
135666c
Added country_codes, members_only to sendPoll;
coder2020official May 10, 2026
167760e
Added classes InputMediaLivePhoto and LivePhoto
coder2020official May 10, 2026
fb11143
Added the field live_photo to the classes Message and ExternalReplyI…
coder2020official May 10, 2026
a57a688
Added the method sendLivePhoto, allowing bots to send live photos.
coder2020official May 10, 2026
ac293e2
Added PaidMediaLivePhoto and InputPaidMediaLivePhoto
coder2020official May 10, 2026
5136e29
Allowed to use live photos in sendMediaGroup and editMessageMedia,
coder2020official May 10, 2026
5b91858
Allowed bots to pass an empty text in the method sendMessageDraft.
coder2020official May 10, 2026
5909976
Added getuserpersonalchatmessages, get_managed_bot_access_settings, s…
coder2020official May 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<p align="center">A simple, but extensible Python implementation for the <a href="https://core.telegram.org/bots/api">Telegram Bot API</a>.</p>
<p align="center">Both synchronous and asynchronous.</p>

## <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>
## <p align="center">Supported Bot API version: <a href="https://core.telegram.org/bots/api#may-8-2026"><img src="https://img.shields.io/badge/Bot%20API-10.0-blue?logo=telegram" alt="Supported Bot API version"></a>

<h2><a href='https://pytba.readthedocs.io/en/latest/index.html'>Official documentation</a></h2>
<h2><a href='https://pytba.readthedocs.io/ru/latest/index.html'>Official ru documentation</a></h2>
Expand Down
296 changes: 290 additions & 6 deletions telebot/__init__.py

Large diffs are not rendered by default.

104 changes: 102 additions & 2 deletions telebot/apihelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,11 @@ def leave_chat(token, chat_id):
return _make_request(token, method_url, params=payload)


def get_chat_administrators(token, chat_id):
def get_chat_administrators(token, chat_id, return_bots=None):
method_url = r'getChatAdministrators'
payload = {'chat_id': chat_id}
if return_bots is not None:
payload['return_bots'] = return_bots
return _make_request(token, method_url, params=payload)


Expand Down Expand Up @@ -621,6 +623,53 @@ def send_photo(
payload['suggested_post_parameters'] = suggested_post_parameters.to_json()
return _make_request(token, method_url, params=payload, files=files, method='post')

def send_live_photo(
token, chat_id, live_photo, photo,
caption=None, parse_mode=None, caption_entities=None, show_caption_above_media=None, has_spoiler=None,
disable_notification=None, protect_content=None, reply_parameters=None, reply_markup=None,
business_connection_id=None, message_effect_id=None, allow_paid_broadcast=None,
direct_messages_topic_id=None, suggested_post_parameters=None):
method_url = r'sendLivePhoto'
files = {}
payload = {'chat_id': chat_id}
if util.is_string(live_photo):
payload['live_photo'] = live_photo
else:
files['live_photo'] = live_photo
if util.is_string(photo):
payload['photo'] = photo
else:
files['photo'] = photo
if caption:
payload['caption'] = caption
if parse_mode:
payload['parse_mode'] = parse_mode
if caption_entities:
payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities))
if show_caption_above_media is not None:
payload['show_caption_above_media'] = show_caption_above_media
if has_spoiler is not None:
payload['has_spoiler'] = has_spoiler
if disable_notification is not None:
payload['disable_notification'] = disable_notification
if protect_content is not None:
payload['protect_content'] = protect_content
if reply_parameters is not None:
payload['reply_parameters'] = reply_parameters.to_json()
if reply_markup:
payload['reply_markup'] = _convert_markup(reply_markup)
if business_connection_id:
payload['business_connection_id'] = business_connection_id
if message_effect_id:
payload['message_effect_id'] = message_effect_id
if allow_paid_broadcast is not None:
payload['allow_paid_broadcast'] = allow_paid_broadcast
if direct_messages_topic_id is not None:
payload['direct_messages_topic_id'] = direct_messages_topic_id
if suggested_post_parameters is not None:
payload['suggested_post_parameters'] = suggested_post_parameters.to_json()
return _make_request(token, method_url, params=payload, files=files or None, method='post')

def send_paid_media(
token, chat_id, star_count, media,
caption=None, parse_mode=None, caption_entities=None, show_caption_above_media=None,
Expand Down Expand Up @@ -1611,6 +1660,26 @@ def get_managed_bot_token(token, user_id):
payload = {'user_id': user_id}
return _make_request(token, method_url, params=payload , method='post')

def set_managed_bot_access_settings(token, user_id, is_access_restricted, added_user_ids=None):
method_url = 'setManagedBotAccessSettings'
payload = {
'user_id': user_id,
'is_access_restricted': is_access_restricted
}
if added_user_ids is not None:
payload['added_user_ids'] = json.dumps(added_user_ids)
return _make_request(token, method_url, params=payload , method='post')

def get_user_personal_chat_messages(token, user_id, limit):
method_url = 'getUserPersonalChatMessages'
payload = {'user_id': user_id, 'limit': limit}
return _make_request(token, method_url, params=payload , method='post')

def get_managed_bot_access_settings(token, user_id):
method_url = 'getManagedBotAccessSettings'
payload = {'user_id': user_id}
return _make_request(token, method_url, params=payload , method='post')

def replace_managed_bot_token(token, user_id):
method_url = 'replaceManagedBotToken'
payload = {'user_id': user_id}
Expand Down Expand Up @@ -2058,6 +2127,10 @@ def answer_callback_query(token, callback_query_id, text=None, show_alert=None,
payload['cache_time'] = cache_time
return _make_request(token, method_url, params=payload, method='post')

def answer_guest_query(token, guest_query_id, result):
method_url = 'answerGuestQuery'
payload = {'guest_query_id': guest_query_id, 'result': result.to_json()}
return _make_request(token, method_url, params=payload, method='post')

def get_user_chat_boosts(token, chat_id, user_id):
method_url = 'getUserChatBoosts'
Expand Down Expand Up @@ -2557,7 +2630,7 @@ def send_poll(
reply_markup=None, timeout=None, explanation_entities=None, protect_content=None, message_thread_id=None,
reply_parameters=None, business_connection_id=None, question_parse_mode=None, question_entities=None, message_effect_id=None,
allow_paid_broadcast=None, allows_revoting=None, shuffle_options=None, allow_adding_options=None, hide_results_until_closes=None,
correct_option_ids=None, description=None, description_parse_mode=None, description_entities=None):
correct_option_ids=None, description=None, description_parse_mode=None, description_entities=None, members_only=None, country_codes=None):
method_url = r'sendPoll'
payload = {
'chat_id': str(chat_id),
Expand Down Expand Up @@ -2624,6 +2697,10 @@ def send_poll(
payload['description_parse_mode'] = description_parse_mode
if description_entities is not None:
payload['description_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(description_entities))
if members_only is not None:
payload['members_only'] = members_only
if country_codes is not None:
payload['country_codes'] = json.dumps(country_codes)
return _make_request(token, method_url, params=payload)

def create_forum_topic(token, chat_id, name, icon_color=None, icon_custom_emoji_id=None):
Expand Down Expand Up @@ -2710,6 +2787,29 @@ def delete_messages(token, chat_id, message_ids):
}
return _make_request(token, method_url, params=payload)

def delete_message_reaction(token, chat_id, message_id, user_id=None, actor_chat_id=None):
method_url = 'deleteMessageReaction'
payload = {
'chat_id': chat_id,
'message_id': message_id
}
if user_id is not None:
payload['user_id'] = user_id
if actor_chat_id is not None:
payload['actor_chat_id'] = actor_chat_id
return _make_request(token, method_url, params=payload, method='post')

def delete_all_message_reactions(token, chat_id, user_id=None, actor_chat_id=None):
method_url = 'deleteAllMessageReactions'
payload = {
'chat_id': chat_id
}
if user_id is not None:
payload['user_id'] = user_id
if actor_chat_id is not None:
payload['actor_chat_id'] = actor_chat_id
return _make_request(token, method_url, params=payload, method='post')

def forward_messages(token, chat_id, from_chat_id, message_ids, disable_notification=None,
message_thread_id=None, protect_content=None, direct_messages_topic_id=None):
method_url = 'forwardMessages'
Expand Down
Loading
Loading