Types of API#

class telebot.types.Animation(file_id, file_unique_id, width=None, height=None, duration=None, thumb=None, file_name=None, mime_type=None, file_size=None, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.Audio(file_id, file_unique_id, duration, performer=None, title=None, file_name=None, mime_type=None, file_size=None, thumb=None, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.BotCommand(command, description)#

Bases: JsonSerializable, JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

to_dict()#
to_json()#

Returns a JSON string representation of this class.

This function must be overridden by subclasses. :return: a JSON formatted string.

class telebot.types.BotCommandScope(type='default', chat_id=None, user_id=None)#

Bases: ABC, JsonSerializable

to_json()#

Returns a JSON string representation of this class.

This function must be overridden by subclasses. :return: a JSON formatted string.

class telebot.types.BotCommandScopeAllChatAdministrators#

Bases: BotCommandScope

class telebot.types.BotCommandScopeAllGroupChats#

Bases: BotCommandScope

class telebot.types.BotCommandScopeAllPrivateChats#

Bases: BotCommandScope

class telebot.types.BotCommandScopeChat(chat_id=None)#

Bases: BotCommandScope

class telebot.types.BotCommandScopeChatAdministrators(chat_id=None)#

Bases: BotCommandScope

class telebot.types.BotCommandScopeChatMember(chat_id=None, user_id=None)#

Bases: BotCommandScope

class telebot.types.BotCommandScopeDefault#

Bases: BotCommandScope

class telebot.types.CallbackQuery(id, from_user, data, chat_instance, json_string, message=None, inline_message_id=None, game_short_name=None, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.Chat(id, type, title=None, username=None, first_name=None, last_name=None, photo=None, bio=None, has_private_forwards=None, description=None, invite_link=None, pinned_message=None, permissions=None, slow_mode_delay=None, message_auto_delete_time=None, has_protected_content=None, sticker_set_name=None, can_set_sticker_set=None, linked_chat_id=None, location=None, join_to_send_messages=None, join_by_request=None, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.ChatAdministratorRights(is_anonymous: bool, can_manage_chat: bool, can_delete_messages: bool, can_manage_video_chats: bool, can_restrict_members: bool, can_promote_members: bool, can_change_info: bool, can_invite_users: bool, can_post_messages: Optional[bool] = None, can_edit_messages: Optional[bool] = None, can_pin_messages: Optional[bool] = None)#

Bases: JsonDeserializable, JsonSerializable

Class representation of: https://core.telegram.org/bots/api#chatadministratorrights

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

to_dict()#
to_json()#

Returns a JSON string representation of this class.

This function must be overridden by subclasses. :return: a JSON formatted string.

Bases: JsonSerializable, JsonDeserializable, Dictionaryable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

to_json()#

Returns a JSON string representation of this class.

This function must be overridden by subclasses. :return: a JSON formatted string.

class telebot.types.ChatJoinRequest(chat, from_user, date, bio=None, invite_link=None, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.ChatLocation(location, address, **kwargs)#

Bases: JsonSerializable, JsonDeserializable, Dictionaryable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

to_json()#

Returns a JSON string representation of this class.

This function must be overridden by subclasses. :return: a JSON formatted string.

class telebot.types.ChatMember(user, status, custom_title=None, is_anonymous=None, can_be_edited=None, can_post_messages=None, can_edit_messages=None, can_delete_messages=None, can_restrict_members=None, can_promote_members=None, can_change_info=None, can_invite_users=None, can_pin_messages=None, is_member=None, can_send_messages=None, can_send_media_messages=None, can_send_polls=None, can_send_other_messages=None, can_add_web_page_previews=None, can_manage_chat=None, can_manage_video_chats=None, until_date=None, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.ChatMemberAdministrator(user, status, custom_title=None, is_anonymous=None, can_be_edited=None, can_post_messages=None, can_edit_messages=None, can_delete_messages=None, can_restrict_members=None, can_promote_members=None, can_change_info=None, can_invite_users=None, can_pin_messages=None, is_member=None, can_send_messages=None, can_send_media_messages=None, can_send_polls=None, can_send_other_messages=None, can_add_web_page_previews=None, can_manage_chat=None, can_manage_video_chats=None, until_date=None, **kwargs)#

Bases: ChatMember

class telebot.types.ChatMemberBanned(user, status, custom_title=None, is_anonymous=None, can_be_edited=None, can_post_messages=None, can_edit_messages=None, can_delete_messages=None, can_restrict_members=None, can_promote_members=None, can_change_info=None, can_invite_users=None, can_pin_messages=None, is_member=None, can_send_messages=None, can_send_media_messages=None, can_send_polls=None, can_send_other_messages=None, can_add_web_page_previews=None, can_manage_chat=None, can_manage_video_chats=None, until_date=None, **kwargs)#

Bases: ChatMember

class telebot.types.ChatMemberLeft(user, status, custom_title=None, is_anonymous=None, can_be_edited=None, can_post_messages=None, can_edit_messages=None, can_delete_messages=None, can_restrict_members=None, can_promote_members=None, can_change_info=None, can_invite_users=None, can_pin_messages=None, is_member=None, can_send_messages=None, can_send_media_messages=None, can_send_polls=None, can_send_other_messages=None, can_add_web_page_previews=None, can_manage_chat=None, can_manage_video_chats=None, until_date=None, **kwargs)#

Bases: ChatMember

class telebot.types.ChatMemberMember(user, status, custom_title=None, is_anonymous=None, can_be_edited=None, can_post_messages=None, can_edit_messages=None, can_delete_messages=None, can_restrict_members=None, can_promote_members=None, can_change_info=None, can_invite_users=None, can_pin_messages=None, is_member=None, can_send_messages=None, can_send_media_messages=None, can_send_polls=None, can_send_other_messages=None, can_add_web_page_previews=None, can_manage_chat=None, can_manage_video_chats=None, until_date=None, **kwargs)#

Bases: ChatMember

class telebot.types.ChatMemberOwner(user, status, custom_title=None, is_anonymous=None, can_be_edited=None, can_post_messages=None, can_edit_messages=None, can_delete_messages=None, can_restrict_members=None, can_promote_members=None, can_change_info=None, can_invite_users=None, can_pin_messages=None, is_member=None, can_send_messages=None, can_send_media_messages=None, can_send_polls=None, can_send_other_messages=None, can_add_web_page_previews=None, can_manage_chat=None, can_manage_video_chats=None, until_date=None, **kwargs)#

Bases: ChatMember

class telebot.types.ChatMemberRestricted(user, status, custom_title=None, is_anonymous=None, can_be_edited=None, can_post_messages=None, can_edit_messages=None, can_delete_messages=None, can_restrict_members=None, can_promote_members=None, can_change_info=None, can_invite_users=None, can_pin_messages=None, is_member=None, can_send_messages=None, can_send_media_messages=None, can_send_polls=None, can_send_other_messages=None, can_add_web_page_previews=None, can_manage_chat=None, can_manage_video_chats=None, until_date=None, **kwargs)#

Bases: ChatMember

class telebot.types.ChatMemberUpdated(chat, from_user, date, old_chat_member, new_chat_member, invite_link=None, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

property difference: Dict[str, List]#

Get the difference between old_chat_member and new_chat_member as a dict in the following format {‘parameter’: [old_value, new_value]} E.g {‘status’: [‘member’, ‘kicked’], ‘until_date’: [None, 1625055092]}

class telebot.types.ChatPermissions(can_send_messages=None, can_send_media_messages=None, can_send_polls=None, can_send_other_messages=None, can_add_web_page_previews=None, can_change_info=None, can_invite_users=None, can_pin_messages=None, **kwargs)#

Bases: JsonDeserializable, JsonSerializable, Dictionaryable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

to_json()#

Returns a JSON string representation of this class.

This function must be overridden by subclasses. :return: a JSON formatted string.

class telebot.types.ChatPhoto(small_file_id, small_file_unique_id, big_file_id, big_file_unique_id, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.ChosenInlineResult(result_id, from_user, query, location=None, inline_message_id=None, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.Contact(phone_number, first_name, last_name=None, user_id=None, vcard=None, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.Dice(value, emoji, **kwargs)#

Bases: JsonSerializable, Dictionaryable, JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

to_json()#

Returns a JSON string representation of this class.

This function must be overridden by subclasses. :return: a JSON formatted string.

class telebot.types.Dictionaryable#

Bases: object

Subclasses of this class are guaranteed to be able to be converted to dictionary. All subclasses of this class must override to_dict.

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

class telebot.types.Document(file_id, file_unique_id, thumb=None, file_name=None, mime_type=None, file_size=None, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.File(file_id, file_unique_id, file_size=None, file_path=None, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.ForceReply(selective: Optional[bool] = None, input_field_placeholder: Optional[str] = None)#

Bases: JsonSerializable

to_json()#

Returns a JSON string representation of this class.

This function must be overridden by subclasses. :return: a JSON formatted string.

class telebot.types.Game(title, description, photo, text=None, text_entities=None, animation=None, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

classmethod parse_entities(message_entity_array)#
classmethod parse_photo(photo_size_array)#
class telebot.types.GameHighScore(position, user, score, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.GroupChat(id, title, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.InlineKeyboardButton(text, url=None, callback_data=None, web_app=None, switch_inline_query=None, switch_inline_query_current_chat=None, callback_game=None, pay=None, login_url=None, **kwargs)#

Bases: Dictionaryable, JsonSerializable, JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

to_json()#

Returns a JSON string representation of this class.

This function must be overridden by subclasses. :return: a JSON formatted string.

class telebot.types.InlineKeyboardMarkup(keyboard=None, row_width=3)#

Bases: Dictionaryable, JsonSerializable, JsonDeserializable

add(*args, row_width=None)#

This method adds buttons to the keyboard without exceeding row_width.

E.g. InlineKeyboardMarkup.add(“A”, “B”, “C”) yields the json result: {keyboard: [[“A”], [“B”], [“C”]]} when row_width is set to 1. When row_width is set to 2, the result: {keyboard: [[“A”, “B”], [“C”]]} See https://core.telegram.org/bots/api#inlinekeyboardmarkup

Parameters
  • args – Array of InlineKeyboardButton to append to the keyboard

  • row_width – width of row

Returns

self, to allow function chaining.

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

max_row_keys = 8#
row(*args)#

Adds a list of InlineKeyboardButton to the keyboard. This method does not consider row_width.

InlineKeyboardMarkup.row(“A”).row(“B”, “C”).to_json() outputs: ‘{keyboard: [[“A”], [“B”, “C”]]}’ See https://core.telegram.org/bots/api#inlinekeyboardmarkup

Parameters

args – Array of InlineKeyboardButton to append to the keyboard

Returns

self, to allow function chaining.

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

to_json()#

Converts this object to its json representation following the Telegram API guidelines described here: https://core.telegram.org/bots/api#inlinekeyboardmarkup :return:

class telebot.types.InlineQuery(id, from_user, query, offset, chat_type=None, location=None, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.InlineQueryResultArticle(id, title, input_message_content, reply_markup=None, url=None, hide_url=None, description=None, thumb_url=None, thumb_width=None, thumb_height=None)#

Bases: InlineQueryResultBase

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

class telebot.types.InlineQueryResultAudio(id, audio_url, title, caption=None, caption_entities=None, parse_mode=None, performer=None, audio_duration=None, reply_markup=None, input_message_content=None)#

Bases: InlineQueryResultBase

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

class telebot.types.InlineQueryResultBase(type, id, title=None, caption=None, input_message_content=None, reply_markup=None, caption_entities=None, parse_mode=None)#

Bases: ABC, Dictionaryable, JsonSerializable

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

to_json()#

Returns a JSON string representation of this class.

This function must be overridden by subclasses. :return: a JSON formatted string.

class telebot.types.InlineQueryResultCachedAudio(id, audio_file_id, caption=None, caption_entities=None, parse_mode=None, reply_markup=None, input_message_content=None)#

Bases: InlineQueryResultCachedBase

class telebot.types.InlineQueryResultCachedBase#

Bases: ABC, JsonSerializable

to_json()#

Returns a JSON string representation of this class.

This function must be overridden by subclasses. :return: a JSON formatted string.

class telebot.types.InlineQueryResultCachedDocument(id, document_file_id, title, description=None, caption=None, caption_entities=None, parse_mode=None, reply_markup=None, input_message_content=None)#

Bases: InlineQueryResultCachedBase

class telebot.types.InlineQueryResultCachedGif(id, gif_file_id, title=None, description=None, caption=None, caption_entities=None, parse_mode=None, reply_markup=None, input_message_content=None)#

Bases: InlineQueryResultCachedBase

class telebot.types.InlineQueryResultCachedMpeg4Gif(id, mpeg4_file_id, title=None, description=None, caption=None, caption_entities=None, parse_mode=None, reply_markup=None, input_message_content=None)#

Bases: InlineQueryResultCachedBase

class telebot.types.InlineQueryResultCachedPhoto(id, photo_file_id, title=None, description=None, caption=None, caption_entities=None, parse_mode=None, reply_markup=None, input_message_content=None)#

Bases: InlineQueryResultCachedBase

class telebot.types.InlineQueryResultCachedSticker(id, sticker_file_id, reply_markup=None, input_message_content=None)#

Bases: InlineQueryResultCachedBase

class telebot.types.InlineQueryResultCachedVideo(id, video_file_id, title, description=None, caption=None, caption_entities=None, parse_mode=None, reply_markup=None, input_message_content=None)#

Bases: InlineQueryResultCachedBase

class telebot.types.InlineQueryResultCachedVoice(id, voice_file_id, title, caption=None, caption_entities=None, parse_mode=None, reply_markup=None, input_message_content=None)#

Bases: InlineQueryResultCachedBase

class telebot.types.InlineQueryResultContact(id, phone_number, first_name, last_name=None, vcard=None, reply_markup=None, input_message_content=None, thumb_url=None, thumb_width=None, thumb_height=None)#

Bases: InlineQueryResultBase

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

class telebot.types.InlineQueryResultDocument(id, title, document_url, mime_type, caption=None, caption_entities=None, parse_mode=None, description=None, reply_markup=None, input_message_content=None, thumb_url=None, thumb_width=None, thumb_height=None)#

Bases: InlineQueryResultBase

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

class telebot.types.InlineQueryResultGame(id, game_short_name, reply_markup=None)#

Bases: InlineQueryResultBase

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

class telebot.types.InlineQueryResultGif(id, gif_url, thumb_url, gif_width=None, gif_height=None, title=None, caption=None, caption_entities=None, reply_markup=None, input_message_content=None, gif_duration=None, parse_mode=None, thumb_mime_type=None)#

Bases: InlineQueryResultBase

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

class telebot.types.InlineQueryResultLocation(id, title, latitude, longitude, horizontal_accuracy, live_period=None, reply_markup=None, input_message_content=None, thumb_url=None, thumb_width=None, thumb_height=None, heading=None, proximity_alert_radius=None)#

Bases: InlineQueryResultBase

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

class telebot.types.InlineQueryResultMpeg4Gif(id, mpeg4_url, thumb_url, mpeg4_width=None, mpeg4_height=None, title=None, caption=None, caption_entities=None, parse_mode=None, reply_markup=None, input_message_content=None, mpeg4_duration=None, thumb_mime_type=None)#

Bases: InlineQueryResultBase

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

class telebot.types.InlineQueryResultPhoto(id, photo_url, thumb_url, photo_width=None, photo_height=None, title=None, description=None, caption=None, caption_entities=None, parse_mode=None, reply_markup=None, input_message_content=None)#

Bases: InlineQueryResultBase

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

class telebot.types.InlineQueryResultVenue(id, title, latitude, longitude, address, foursquare_id=None, foursquare_type=None, reply_markup=None, input_message_content=None, thumb_url=None, thumb_width=None, thumb_height=None, google_place_id=None, google_place_type=None)#

Bases: InlineQueryResultBase

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

class telebot.types.InlineQueryResultVideo(id, video_url, mime_type, thumb_url, title, caption=None, caption_entities=None, parse_mode=None, video_width=None, video_height=None, video_duration=None, description=None, reply_markup=None, input_message_content=None)#

Bases: InlineQueryResultBase

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

class telebot.types.InlineQueryResultVoice(id, voice_url, title, caption=None, caption_entities=None, parse_mode=None, voice_duration=None, reply_markup=None, input_message_content=None)#

Bases: InlineQueryResultBase

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

class telebot.types.InputContactMessageContent(phone_number, first_name, last_name=None, vcard=None)#

Bases: Dictionaryable

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

class telebot.types.InputInvoiceMessageContent(title, description, payload, provider_token, currency, prices, max_tip_amount=None, suggested_tip_amounts=None, provider_data=None, photo_url=None, photo_size=None, photo_width=None, photo_height=None, need_name=None, need_phone_number=None, need_email=None, need_shipping_address=None, send_phone_number_to_provider=None, send_email_to_provider=None, is_flexible=None)#

Bases: Dictionaryable

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

class telebot.types.InputLocationMessageContent(latitude, longitude, horizontal_accuracy=None, live_period=None, heading=None, proximity_alert_radius=None)#

Bases: Dictionaryable

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

class telebot.types.InputMedia(type, media, caption=None, parse_mode=None, caption_entities=None)#

Bases: Dictionaryable, JsonSerializable

convert_input_media()#
to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

to_json()#

Returns a JSON string representation of this class.

This function must be overridden by subclasses. :return: a JSON formatted string.

class telebot.types.InputMediaAnimation(media, thumb=None, caption=None, parse_mode=None, width=None, height=None, duration=None)#

Bases: InputMedia

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

class telebot.types.InputMediaAudio(media, thumb=None, caption=None, parse_mode=None, duration=None, performer=None, title=None)#

Bases: InputMedia

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

class telebot.types.InputMediaDocument(media, thumb=None, caption=None, parse_mode=None, disable_content_type_detection=None)#

Bases: InputMedia

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

class telebot.types.InputMediaPhoto(media, caption=None, parse_mode=None)#

Bases: InputMedia

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

class telebot.types.InputMediaVideo(media, thumb=None, caption=None, parse_mode=None, width=None, height=None, duration=None, supports_streaming=None)#

Bases: InputMedia

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

class telebot.types.InputTextMessageContent(message_text, parse_mode=None, entities=None, disable_web_page_preview=None)#

Bases: Dictionaryable

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

class telebot.types.InputVenueMessageContent(latitude, longitude, title, address, foursquare_id=None, foursquare_type=None, google_place_id=None, google_place_type=None)#

Bases: Dictionaryable

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

class telebot.types.Invoice(title, description, start_parameter, currency, total_amount, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.JsonDeserializable#

Bases: object

Subclasses of this class are guaranteed to be able to be created from a json-style dict or json formatted string. All subclasses of this class must override de_json.

static check_json(json_type, dict_copy=True)#

Checks whether json_type is a dict or a string. If it is already a dict, it is returned as-is. If it is not, it is converted to a dict by means of json.loads(json_type)

Parameters
  • json_type – input json or parsed dict

  • dict_copy – if dict is passed and it is changed outside - should be True!

Returns

Dictionary parsed from json or original dict

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.JsonSerializable#

Bases: object

Subclasses of this class are guaranteed to be able to be converted to JSON format. All subclasses of this class must override to_json.

to_json()#

Returns a JSON string representation of this class.

This function must be overridden by subclasses. :return: a JSON formatted string.

class telebot.types.KeyboardButton(text: str, request_contact: Optional[bool] = None, request_location: Optional[bool] = None, request_poll: Optional[KeyboardButtonPollType] = None, web_app: Optional[WebAppInfo] = None)#

Bases: Dictionaryable, JsonSerializable

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

to_json()#

Returns a JSON string representation of this class.

This function must be overridden by subclasses. :return: a JSON formatted string.

class telebot.types.KeyboardButtonPollType(type='')#

Bases: Dictionaryable

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

class telebot.types.LabeledPrice(label, amount)#

Bases: JsonSerializable

to_dict()#
to_json()#

Returns a JSON string representation of this class.

This function must be overridden by subclasses. :return: a JSON formatted string.

class telebot.types.Location(longitude, latitude, horizontal_accuracy=None, live_period=None, heading=None, proximity_alert_radius=None, **kwargs)#

Bases: JsonDeserializable, JsonSerializable, Dictionaryable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

to_json()#

Returns a JSON string representation of this class.

This function must be overridden by subclasses. :return: a JSON formatted string.

class telebot.types.LoginUrl(url, forward_text=None, bot_username=None, request_write_access=None, **kwargs)#

Bases: Dictionaryable, JsonSerializable, JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

to_json()#

Returns a JSON string representation of this class.

This function must be overridden by subclasses. :return: a JSON formatted string.

class telebot.types.MaskPosition(point, x_shift, y_shift, scale, **kwargs)#

Bases: Dictionaryable, JsonDeserializable, JsonSerializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

to_json()#

Returns a JSON string representation of this class.

This function must be overridden by subclasses. :return: a JSON formatted string.

class telebot.types.MenuButton#

Bases: JsonDeserializable, JsonSerializable

Base class for MenuButtons.

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

to_json()#

Returns a JSON string representation of this class.

This function must be overridden by subclasses. :return: a JSON formatted string.

class telebot.types.MenuButtonCommands(type)#

Bases: MenuButton

to_dict()#
to_json()#

Returns a JSON string representation of this class.

This function must be overridden by subclasses. :return: a JSON formatted string.

class telebot.types.MenuButtonDefault(type)#

Bases: MenuButton

to_dict()#
to_json()#

Returns a JSON string representation of this class.

This function must be overridden by subclasses. :return: a JSON formatted string.

class telebot.types.MenuButtonWebApp(type, text, web_app)#

Bases: MenuButton

to_dict()#
to_json()#

Returns a JSON string representation of this class.

This function must be overridden by subclasses. :return: a JSON formatted string.

class telebot.types.Message(message_id, from_user, date, chat, content_type, options, json_string)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

property html_caption#
property html_text#
classmethod parse_chat(chat)#
classmethod parse_entities(message_entity_array)#
classmethod parse_photo(photo_size_array)#
class telebot.types.MessageAutoDeleteTimerChanged(message_auto_delete_time, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.MessageEntity(type, offset, length, url=None, user=None, language=None, **kwargs)#

Bases: Dictionaryable, JsonSerializable, JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

to_json()#

Returns a JSON string representation of this class.

This function must be overridden by subclasses. :return: a JSON formatted string.

static to_list_of_dicts(entity_list) Optional[List[Dict]]#
class telebot.types.MessageID(message_id, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.OrderInfo(name=None, phone_number=None, email=None, shipping_address=None, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.PhotoSize(file_id, file_unique_id, width, height, file_size=None, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.Poll(question, options, poll_id=None, total_voter_count=None, is_closed=None, is_anonymous=None, type=None, allows_multiple_answers=None, correct_option_id=None, explanation=None, explanation_entities=None, open_period=None, close_date=None, poll_type=None, **kwargs)#

Bases: JsonDeserializable

add(option)#
classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.PollAnswer(poll_id, user, option_ids, **kwargs)#

Bases: JsonSerializable, JsonDeserializable, Dictionaryable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

to_json()#

Returns a JSON string representation of this class.

This function must be overridden by subclasses. :return: a JSON formatted string.

class telebot.types.PollOption(text, voter_count=0, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.PreCheckoutQuery(id, from_user, currency, total_amount, invoice_payload, shipping_option_id=None, order_info=None, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.ProximityAlertTriggered(traveler, watcher, distance, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.ReplyKeyboardMarkup(resize_keyboard: Optional[bool] = None, one_time_keyboard: Optional[bool] = None, selective: Optional[bool] = None, row_width: int = 3, input_field_placeholder: Optional[str] = None)#

Bases: JsonSerializable

add(*args, row_width=None)#

This function adds strings to the keyboard, while not exceeding row_width. E.g. ReplyKeyboardMarkup#add(“A”, “B”, “C”) yields the json result {keyboard: [[“A”], [“B”], [“C”]]} when row_width is set to 1. When row_width is set to 2, the following is the result of this function: {keyboard: [[“A”, “B”], [“C”]]} See https://core.telegram.org/bots/api#replykeyboardmarkup

Parameters
  • args – KeyboardButton to append to the keyboard

  • row_width – width of row

Returns

self, to allow function chaining.

max_row_keys = 12#
row(*args)#

Adds a list of KeyboardButton to the keyboard. This function does not consider row_width. ReplyKeyboardMarkup#row(“A”)#row(“B”, “C”)#to_json() outputs ‘{keyboard: [[“A”], [“B”, “C”]]}’ See https://core.telegram.org/bots/api#replykeyboardmarkup

Parameters

args – strings

Returns

self, to allow function chaining.

to_json()#

Converts this object to its json representation following the Telegram API guidelines described here: https://core.telegram.org/bots/api#replykeyboardmarkup :return:

class telebot.types.ReplyKeyboardRemove(selective=None)#

Bases: JsonSerializable

to_json()#

Returns a JSON string representation of this class.

This function must be overridden by subclasses. :return: a JSON formatted string.

class telebot.types.SentWebAppMessage(inline_message_id=None)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

to_dict()#
class telebot.types.ShippingAddress(country_code, state, city, street_line1, street_line2, post_code, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.ShippingOption(id, title)#

Bases: JsonSerializable

add_price(*args)#

Add LabeledPrice to ShippingOption

Parameters

args – LabeledPrices

to_json()#

Returns a JSON string representation of this class.

This function must be overridden by subclasses. :return: a JSON formatted string.

class telebot.types.ShippingQuery(id, from_user, invoice_payload, shipping_address, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.Sticker(file_id, file_unique_id, width, height, is_animated, is_video, thumb=None, emoji=None, set_name=None, mask_position=None, file_size=None, premium_animation=None, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.StickerSet(name, title, is_animated, is_video, contains_masks, stickers, thumb=None, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.SuccessfulPayment(currency, total_amount, invoice_payload, shipping_option_id=None, order_info=None, telegram_payment_charge_id=None, provider_payment_charge_id=None, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.Update(update_id, 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)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.User(id, is_bot, first_name, last_name=None, username=None, language_code=None, can_join_groups=None, can_read_all_group_messages=None, supports_inline_queries=None, is_premium=None, added_to_attachment_menu=None, **kwargs)#

Bases: JsonDeserializable, Dictionaryable, JsonSerializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

property full_name#
to_dict()#

Returns a DICT with class field values

This function must be overridden by subclasses. :return: a DICT

to_json()#

Returns a JSON string representation of this class.

This function must be overridden by subclasses. :return: a JSON formatted string.

class telebot.types.UserProfilePhotos(total_count, photos=None, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.Venue(location, title, address, foursquare_id=None, foursquare_type=None, google_place_id=None, google_place_type=None, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.Video(file_id, file_unique_id, width, height, duration, thumb=None, file_name=None, mime_type=None, file_size=None, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.VideoChatEnded(duration, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.VideoChatParticipantsInvited(users=None, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.VideoChatScheduled(start_date, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.VideoChatStarted#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.VideoNote(file_id, file_unique_id, length, duration, thumb=None, file_size=None, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.Voice(file_id, file_unique_id, duration, mime_type=None, file_size=None, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

class telebot.types.VoiceChatEnded(*args, **kwargs)#

Bases: VideoChatEnded

class telebot.types.VoiceChatParticipantsInvited(*args, **kwargs)#

Bases: VideoChatParticipantsInvited

class telebot.types.VoiceChatScheduled(*args, **kwargs)#

Bases: VideoChatScheduled

class telebot.types.VoiceChatStarted#

Bases: VideoChatStarted

class telebot.types.WebAppData(data, button_text)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

to_dict()#
class telebot.types.WebAppInfo(url, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.

to_dict()#
class telebot.types.WebhookInfo(url, has_custom_certificate, pending_update_count, ip_address=None, last_error_date=None, last_error_message=None, last_synchronization_error_date=None, max_connections=None, allowed_updates=None, **kwargs)#

Bases: JsonDeserializable

classmethod de_json(json_string)#

Returns an instance of this class from the given json dict or string.

This function must be overridden by subclasses. :return: an instance of this class created from the given json dict or string.