telegram.constants Module¶
This module contains several constants that are relevant for working with the Bot API.
Unless noted otherwise, all constants in this module were extracted from the Telegram Bots FAQ and Telegram Bots API.
Most of the following constants are related to specific classes or topics and are grouped into enums. If they are related to a specific class, then they are also available as attributes of those classes.
Changed in version 20.0:
Most of the constants in this module are grouped into enums.
Removed in version 22.3: Removed deprecated class StarTransactions. Please instead use
telegram.constants.Nanostar.VALUE.
- class telegram.constants.AccentColor(*values)[source]¶
Bases:
EnumThis enum contains the available accent colors for
telegram.ChatFullInfo.accent_color_id. The members of this enum are named tuples with the following attributes:identifier(int): The identifier of the accent color.name(str): Optional. The name of the accent color.light_colors(tuple[str]): Optional. The light colors of the accent color as HEX value.dark_colors(tuple[str]): Optional. The dark colors of the accent color as HEX value.
Since Telegram gives no exact specification for the accent colors, future accent colors might have a different data type.
Added in version 20.8.
- COLOR_001 = (1, 'orange', (), ())[source]¶
Accent color 1. This color can be customized by app themes.
- COLOR_002 = (2, 'purple/violet', (), ())[source]¶
Accent color 2. This color can be customized by app themes.
- COLOR_003 = (3, 'green', (), ())[source]¶
Accent color 3. This color can be customized by app themes.
- COLOR_004 = (4, 'cyan', (), ())[source]¶
Accent color 4. This color can be customized by app themes.
- COLOR_005 = (5, 'blue', (), ())[source]¶
Accent color 5. This color can be customized by app themes.
- COLOR_006 = (6, 'pink', (), ())[source]¶
Accent color 6. This color can be customized by app themes.
- COLOR_007 = (7, None, (14766162, 16363107), (16749440, 10039095))[source]¶
Accent color 7. This contains two light colors
and two dark colors
- COLOR_008 = (8, None, (14712875, 16434484), (15511630, 12801812))[source]¶
Accent color 8. This contains two light colors
and two dark colors
- COLOR_009 = (9, None, (10510323, 16027647), (13015039, 6173128))[source]¶
Accent color 9. This contains two light colors
and two dark colors
- COLOR_010 = (10, None, (2599184, 11000919), (11004782, 1474093))[source]¶
Accent color 10. This contains two light colors
and two dark colors
- COLOR_011 = (11, None, (2600142, 8579286), (4249808, 285823))[source]¶
Accent color 11. This contains two light colors
and two dark colors
- COLOR_012 = (12, None, (3379668, 8246256), (5423103, 742548))[source]¶
Accent color 12. This contains two light colors
and two dark colors
- COLOR_013 = (13, None, (14500721, 16760479), (16746150, 9320046))[source]¶
Accent color 13. This contains two light colors
and two dark colors
- COLOR_014 = (14, None, (2391021, 15747158, 16777215), (4170494, 15024719, 16777215))[source]¶
Accent color 14. This contains three light colors
and three dark colors
- COLOR_015 = (15, None, (14055202, 2007057, 16777215), (16748638, 3319079, 16777215))[source]¶
Accent color 15. This contains three light colors
and three dark colors
- COLOR_016 = (16, None, (1547842, 15223359, 16777215), (6738788, 13976655, 16777215))[source]¶
Accent color 16. This contains three light colors
and three dark colors
- COLOR_017 = (17, None, (2659503, 7324758, 16777215), (2276578, 4039232, 16777215))[source]¶
Accent color 17. This contains three light colors
and three dark colors
- COLOR_018 = (18, None, (826035, 16756117, 16770741), (2276578, 16750456, 16767595))[source]¶
Accent color 18. This contains three light colors
and three dark colors
- telegram.constants.BOT_API_VERSION = '9.5'[source]¶
Telegram Bot API version supported by this version of python-telegram-bot. Also available as
telegram.__bot_api_version__.Added in version 13.4.
- Type:
str
- telegram.constants.BOT_API_VERSION_INFO = (9, 5)[source]¶
The components can also be accessed by name, so
BOT_API_VERSION_INFO[0]is equivalent toBOT_API_VERSION_INFO.majorand so on. Also available astelegram.__bot_api_version_info__.Added in version 20.0.
- class telegram.constants.BackgroundFillLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.BackgroundFillGradient. The enum members of this enumeration are instances ofintand can be treated as such.Added in version 21.2.
- MAX_ROTATION_ANGLE = 359[source]¶
Maximum value allowed for:
rotation_angleparameter oftelegram.BackgroundFillGradient- Type:
int
- class telegram.constants.BackgroundFillType(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available types of
telegram.BackgroundFill. The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 21.2.
- FREEFORM_GRADIENT = 'freeform_gradient'[source]¶
A
telegram.BackgroundFillwith freeform_gradient fill.- Type:
str
- GRADIENT = 'gradient'[source]¶
A
telegram.BackgroundFillwith gradient fill.- Type:
str
- SOLID = 'solid'[source]¶
A
telegram.BackgroundFillwith solid fill.- Type:
str
- class telegram.constants.BackgroundTypeLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.BackgroundTypeFill,telegram.BackgroundTypeWallpaperandtelegram.BackgroundTypePattern. The enum members of this enumeration are instances ofintand can be treated as such.Added in version 21.2.
- MAX_DIMMING = 100[source]¶
Maximum value allowed for:
dark_theme_dimmingparameter of
dark_theme_dimmingparameter of
- Type:
int
- MAX_INTENSITY = 100[source]¶
Maximum value allowed for
intensityparameter oftelegram.BackgroundTypePattern- Type:
int
- class telegram.constants.BackgroundTypeType(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available types of
telegram.BackgroundType. The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 21.2.
- CHAT_THEME = 'chat_theme'[source]¶
A
telegram.BackgroundTypewith chat_theme background.- Type:
str
- FILL = 'fill'[source]¶
A
telegram.BackgroundTypewith fill background.- Type:
str
- PATTERN = 'pattern'[source]¶
A
telegram.BackgroundTypewith pattern background.- Type:
str
- WALLPAPER = 'wallpaper'[source]¶
A
telegram.BackgroundTypewith wallpaper background.- Type:
str
- class telegram.constants.BotCommandLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.BotCommandandtelegram.Bot.set_my_commands(). The enum members of this enumeration are instances ofintand can be treated as such.Added in version 20.0.
- MAX_COMMAND = 32[source]¶
Maximum value allowed for
commandparameter oftelegram.BotCommand.- Type:
int
- MAX_COMMAND_NUMBER = 100[source]¶
Maximum number of bot commands passed in a
listto thecommandsparameter oftelegram.Bot.set_my_commands().- Type:
int
- MAX_DESCRIPTION = 256[source]¶
Maximum value allowed for
descriptionparameter oftelegram.BotCommand.- Type:
int
- MIN_COMMAND = 1[source]¶
Minimum value allowed for
commandparameter oftelegram.BotCommand.- Type:
int
- MIN_DESCRIPTION = 1[source]¶
Minimum value allowed for
descriptionparameter oftelegram.BotCommand.- Type:
int
- class telegram.constants.BotCommandScopeType(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available types of
telegram.BotCommandScope. The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 20.0.
- ALL_CHAT_ADMINISTRATORS = 'all_chat_administrators'[source]¶
The type of
telegram.BotCommandScopeAllChatAdministrators.- Type:
str
- ALL_GROUP_CHATS = 'all_group_chats'[source]¶
The type of
telegram.BotCommandScopeAllGroupChats.- Type:
str
- ALL_PRIVATE_CHATS = 'all_private_chats'[source]¶
The type of
telegram.BotCommandScopeAllPrivateChats.- Type:
str
- CHAT = 'chat'[source]¶
The type of
telegram.BotCommandScopeChat.- Type:
str
- CHAT_ADMINISTRATORS = 'chat_administrators'[source]¶
The type of
telegram.BotCommandScopeChatAdministrators.- Type:
str
- CHAT_MEMBER = 'chat_member'[source]¶
The type of
telegram.BotCommandScopeChatMember.- Type:
str
- DEFAULT = 'default'[source]¶
The type of
telegram.BotCommandScopeDefault.- Type:
str
- class telegram.constants.BotDescriptionLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for the methods
telegram.Bot.set_my_description()andtelegram.Bot.set_my_short_description(). The enum members of this enumeration are instances ofintand can be treated as such.Added in version 20.2.
- MAX_DESCRIPTION_LENGTH = 512[source]¶
Maximum length for the parameter
descriptionoftelegram.Bot.set_my_description()- Type:
int
- MAX_SHORT_DESCRIPTION_LENGTH = 120[source]¶
Maximum length for the parameter
short_descriptionoftelegram.Bot.set_my_short_description()- Type:
int
- class telegram.constants.BotNameLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for the methods
telegram.Bot.set_my_name(). The enum members of this enumeration are instances ofintand can be treated as such.Added in version 20.3.
- MAX_NAME_LENGTH = 64[source]¶
Maximum length for the parameter
nameoftelegram.Bot.set_my_name()- Type:
int
- class telegram.constants.BulkRequestLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.Bot.delete_messages(),telegram.Bot.forward_messages()andtelegram.Bot.copy_messages(). The enum members of this enumeration are instances ofintand can be treated as such.Added in version 20.8.
- class telegram.constants.BusinessLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations related to handling business accounts. The enum members of this enumeration are instances of
intand can be treated as such.Added in version 22.1.
- CHAT_ACTIVITY_TIMEOUT = 86400[source]¶
Time in seconds in which the chat must have been active for. Relevant for
chat_idofread_business_message()andnew_owner_chat_idoftransfer_gift().- Type:
int
- MAX_BIO_LENGTH = 140[source]¶
Maximum length of the bio of a business account. Relevant for
biooftelegram.Bot.set_business_account_bio().- Type:
int
- MAX_NAME_LENGTH = 64[source]¶
Maximum length of the name of a business account. Relevant for the parameters of
telegram.Bot.set_business_account_name().- Type:
int
- MAX_STAR_COUNT = 10000[source]¶
Maximum number of Telegram Stars to be transfered. Relevant for
star_countoftelegram.Bot.transfer_business_account_stars().- Type:
int
- MAX_USERNAME_LENGTH = 32[source]¶
Maximum length of the username of a business account. Relevant for
usernameoftelegram.Bot.set_business_account_username().- Type:
int
- MIN_NAME_LENGTH = 1[source]¶
Minimum length of the name of a business account. Relevant only for
first_nameoftelegram.Bot.set_business_account_name().- Type:
int
- MIN_STAR_COUNT = 1[source]¶
Minimum number of Telegram Stars to be transfered. Relevant for
star_countoftelegram.Bot.transfer_business_account_stars().- Type:
int
- class telegram.constants.CallbackQueryLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.CallbackQuery/telegram.Bot.answer_callback_query(). The enum members of this enumeration are instances ofintand can be treated as such.Added in version 20.0.
- ANSWER_CALLBACK_QUERY_TEXT_LENGTH = 200[source]¶
Maximum number of characters in a
strpassed as thetextparameter oftelegram.Bot.answer_callback_query().- Type:
int
- class telegram.constants.ChatAction(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available chat actions for
telegram.Bot.send_chat_action(). The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 20.0.
- CHOOSE_STICKER = 'choose_sticker'[source]¶
Chat action indicating that the bot is selecting a sticker.
- Type:
str
- FIND_LOCATION = 'find_location'[source]¶
Chat action indicating that the bot is selecting a location.
- Type:
str
- RECORD_VIDEO = 'record_video'[source]¶
Chat action indicating that the bot is recording a video.
- Type:
str
- RECORD_VIDEO_NOTE = 'record_video_note'[source]¶
Chat action indicating that the bot is recording a video note.
- Type:
str
- RECORD_VOICE = 'record_voice'[source]¶
Chat action indicating that the bot is recording a voice message.
- Type:
str
- UPLOAD_DOCUMENT = 'upload_document'[source]¶
Chat action indicating that the bot is uploading a document.
- Type:
str
- UPLOAD_PHOTO = 'upload_photo'[source]¶
Chat action indicating that the bot is uploading a photo.
- Type:
str
- UPLOAD_VIDEO = 'upload_video'[source]¶
Chat action indicating that the bot is uploading a video.
- Type:
str
- class telegram.constants.ChatBoostSources(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available sources for a
Telegram chat boost. The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 20.8.
- GIFT_CODE = 'gift_code'[source]¶
The source of the chat boost was a Telegram Premium gift code.
- Type:
str
- class telegram.constants.ChatID(*values)[source]¶
Bases:
enum.IntEnumThis enum contains some special chat IDs. The enum members of this enumeration are instances of
intand can be treated as such.Added in version 20.0.
- ANONYMOUS_ADMIN = 1087968824[source]¶
User ID in groups for messages sent by anonymous admins. Telegram chat: @GroupAnonymousBot.
Note
telegram.Message.from_userwill contain this ID for backwards compatibility only. It’s recommended to usetelegram.Message.sender_chatinstead.- Type:
int
- FAKE_CHANNEL = 136817688[source]¶
User ID in groups when message is sent on behalf of a channel, or when a channel votes on a poll. Telegram chat: @Channel_Bot.
Note
telegram.Message.from_userwill contain this ID for backwards compatibility only. It’s recommended to usetelegram.Message.sender_chatinstead.telegram.PollAnswer.userwill contain this ID for backwards compatibility only. It’s recommended to usetelegram.PollAnswer.voter_chatinstead.
- Type:
int
- SERVICE_CHAT = 777000[source]¶
Telegram service chat, that also acts as sender of channel posts forwarded to discussion groups. Telegram chat: Telegram.
Note
telegram.Message.from_userwill contain this ID for backwards compatibility only. It’s recommended to usetelegram.Message.sender_chatinstead.- Type:
int
- class telegram.constants.ChatInviteLinkLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.ChatInviteLink/telegram.Bot.create_chat_invite_link()/telegram.Bot.edit_chat_invite_link(). The enum members of this enumeration are instances ofintand can be treated as such.Added in version 20.0.
- MAX_MEMBER_LIMIT = 99999[source]¶
Maximum value allowed for the
member_limitparameter oftelegram.Bot.create_chat_invite_link()andmember_limitoftelegram.Bot.edit_chat_invite_link().- Type:
int
- MIN_MEMBER_LIMIT = 1[source]¶
Minimum value allowed for the
member_limitparameter oftelegram.Bot.create_chat_invite_link()andmember_limitoftelegram.Bot.edit_chat_invite_link().- Type:
int
- NAME_LENGTH = 32[source]¶
Maximum number of characters in a
strpassed as thenameparameter oftelegram.Bot.create_chat_invite_link()andnameoftelegram.Bot.edit_chat_invite_link().- Type:
int
- class telegram.constants.ChatLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.Bot.set_chat_administrator_custom_title(),telegram.Bot.set_chat_description(), andtelegram.Bot.set_chat_title(). The enum members of this enumeration are instances ofintand can be treated as such.Added in version 20.0.
- CHAT_ADMINISTRATOR_CUSTOM_TITLE_LENGTH = 16[source]¶
Maximum length of a
strpassed as thecustom_titleparameter oftelegram.Bot.set_chat_administrator_custom_title().- Type:
int
- CHAT_DESCRIPTION_LENGTH = 255[source]¶
Maximum number of characters in a
strpassed as thedescriptionparameter oftelegram.Bot.set_chat_description().- Type:
int
- MAX_CHAT_TITLE_LENGTH = 128[source]¶
Maximum length of a
strpassed as thetitleparameter oftelegram.Bot.set_chat_title().- Type:
int
- MIN_CHAT_TITLE_LENGTH = 1[source]¶
Minimum length of a
strpassed as thetitleparameter oftelegram.Bot.set_chat_title().- Type:
int
- class telegram.constants.ChatMemberStatus(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available states for
telegram.ChatMember. The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 20.0.
- ADMINISTRATOR = 'administrator'[source]¶
A
telegram.ChatMemberwho is administrator of the chat.- Type:
str
- BANNED = 'kicked'[source]¶
A
telegram.ChatMemberwho was banned in the chat.- Type:
str
- LEFT = 'left'[source]¶
A
telegram.ChatMemberwho has left the chat.- Type:
str
- MEMBER = 'member'[source]¶
A
telegram.ChatMemberwho is a member of the chat.- Type:
str
- OWNER = 'creator'[source]¶
A
telegram.ChatMemberwho is the owner of the chat.- Type:
str
- RESTRICTED = 'restricted'[source]¶
A
telegram.ChatMemberwho was restricted in this chat.- Type:
str
- class telegram.constants.ChatPhotoSize(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.ChatPhoto. The enum members of this enumeration are instances ofintand can be treated as such.Added in version 20.0.
- BIG = 640[source]¶
Width and height of a big chat photo, ID of which is passed in
big_file_idandbig_file_unique_idparameters oftelegram.ChatPhoto.- Type:
int
- SMALL = 160[source]¶
Width and height of a small chat photo, ID of which is passed in
small_file_idandsmall_file_unique_idparameters oftelegram.ChatPhoto.- Type:
int
- class telegram.constants.ChatSubscriptionLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.Bot.create_chat_subscription_invite_link.subscription_periodandtelegram.Bot.create_chat_subscription_invite_link.subscription_price. The enum members of this enumeration are instances ofintand can be treated as such.Added in version 21.5.
- MAX_PRICE = 10000[source]¶
Amount of stars a user pays, maximum amount the subscription can be set to.
Changed in version 22.1: Bot API 9.0 changed the value to 10000.
- Type:
int
- class telegram.constants.ChatType(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available types of
telegram.Chat. The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 20.0.
- CHANNEL = 'channel'[source]¶
A
telegram.Chatthat is a channel.- Type:
str
- GROUP = 'group'[source]¶
A
telegram.Chatthat is a group.- Type:
str
- PRIVATE = 'private'[source]¶
A
telegram.Chatthat is private.- Type:
str
- SENDER = 'sender'[source]¶
A
telegram.Chatthat represents the chat of atelegram.Usersending antelegram.InlineQuery.- Type:
str
- SUPERGROUP = 'supergroup'[source]¶
A
telegram.Chatthat is a supergroup.- Type:
str
- class telegram.constants.ContactLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.InlineQueryResultContact,telegram.InputContactMessageContent, andtelegram.Bot.send_contact(). The enum members of this enumeration are instances ofintand can be treated as such.Added in version 20.0.
- VCARD = 2048[source]¶
Maximum value allowed for:
vcardparameter ofsend_contact()vcardparameter ofInlineQueryResultContactvcardparameter ofInputContactMessageContent
- Type:
int
- class telegram.constants.CustomEmojiStickerLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.Bot.get_custom_emoji_stickers(). The enum members of this enumeration are instances ofintand can be treated as such.Added in version 20.0.
- CUSTOM_EMOJI_IDENTIFIER_LIMIT = 200[source]¶
Maximum amount of custom emoji identifiers which can be specified for the
custom_emoji_idsparameter oftelegram.Bot.get_custom_emoji_stickers().- Type:
int
- class telegram.constants.DiceEmoji(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available emoji for
telegram.Dice/telegram.Bot.send_dice(). The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 20.0.
- BASKETBALL = '🏀'[source]¶
A
telegram.Dicewith the emoji🏀.- Type:
str
- BOWLING = '🎳'[source]¶
A
telegram.Dicewith the emoji🎳.- Type:
str
- DARTS = '🎯'[source]¶
A
telegram.Dicewith the emoji🎯.- Type:
str
- DICE = '🎲'[source]¶
A
telegram.Dicewith the emoji🎲.- Type:
str
- FOOTBALL = '⚽'[source]¶
A
telegram.Dicewith the emoji⚽.- Type:
str
- SLOT_MACHINE = '🎰'[source]¶
A
telegram.Dicewith the emoji🎰.- Type:
str
- class telegram.constants.DiceLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.Dice. The enum members of this enumeration are instances ofintand can be treated as such.Added in version 20.0.
- MAX_VALUE_BASKETBALL = 5[source]¶
Maximum value allowed for
valueparameter oftelegram.Diceifemojiis'🏀'.- Type:
int
- MAX_VALUE_BOWLING = 6[source]¶
Maximum value allowed for
valueparameter oftelegram.Diceifemojiis'🎳'.- Type:
int
- MAX_VALUE_DARTS = 6[source]¶
Maximum value allowed for
valueparameter oftelegram.Diceifemojiis'🎯'.- Type:
int
- MAX_VALUE_DICE = 6[source]¶
Maximum value allowed for
valueparameter oftelegram.Diceifemojiis'🎲'.- Type:
int
- MAX_VALUE_FOOTBALL = 5[source]¶
Maximum value allowed for
valueparameter oftelegram.Diceifemojiis'⚽'.- Type:
int
- MAX_VALUE_SLOT_MACHINE = 64[source]¶
Maximum value allowed for
valueparameter oftelegram.Diceifemojiis'🎰'.- Type:
int
- MIN_VALUE = 1[source]¶
Minimum value allowed for
valueparameter oftelegram.Dice(any emoji).- Type:
int
- class telegram.constants.FileSizeLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations regarding the upload and download of files. The enum members of this enumeration are instances of
intand can be treated as such.Added in version 20.0.
- FILESIZE_DOWNLOAD_LOCAL_MODE = 9223372036854775807[source]¶
Bots can download files without a size limit when using a local bot API server.
- Type:
int
- FILESIZE_UPLOAD = 50000000[source]¶
Bots can upload non-photo files of up to 50MB in size.
- Type:
int
- FILESIZE_UPLOAD_LOCAL_MODE = 2000000000[source]¶
Bots can upload non-photo files of up to 2000MB in size when using a local bot API server.
- Type:
int
- VOICE_NOTE_FILE_SIZE = 1000000[source]¶
File size limit for the
send_voice()method oftelegram.Bot. Bots can send audio/ogg files of up to 1MB in size as a voice note. Larger voice notes (up to 20MB) will be sent as files.- Type:
int
- class telegram.constants.FloodLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations regarding flood limits. The enum members of this enumeration are instances of
intand can be treated as such.Added in version 20.0.
- MESSAGES_PER_MINUTE_PER_GROUP = 20[source]¶
The number of messages that can roughly be sent to a particular group within one minute.
- Type:
int
- MESSAGES_PER_SECOND = 30[source]¶
The number of messages that can roughly be sent in an interval of 30 seconds across all chats.
- Type:
int
- MESSAGES_PER_SECOND_PER_CHAT = 1[source]¶
The number of messages that can be sent per second in a particular chat. Telegram may allow short bursts that go over this limit, but eventually you’ll begin receiving 429 errors.
- Type:
int
- PAID_MESSAGES_PER_SECOND = 1000[source]¶
The number of messages that can be sent per second when paying with the bot’s Telegram Star balance. See e.g. parameter
allow_paid_broadcastofsend_message().Added in version 21.7.
- Type:
int
- class telegram.constants.ForumIconColor(*values)[source]¶
Bases:
enum.IntEnumThis enum contains the available colors for use in
telegram.Bot.create_forum_topic.icon_color. The enum members of this enumeration are instances ofintand can be treated as such.Added in version 20.0.
- class telegram.constants.ForumTopicLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.Bot.create_forum_topic.nameandtelegram.Bot.edit_forum_topic.name. The enum members of this enumeration are instances ofintand can be treated as such.Added in version 20.0.
- MAX_NAME_LENGTH = 128[source]¶
Maximum length of a
strpassed as:nameparameter oftelegram.Bot.create_forum_topic()nameparameter oftelegram.Bot.edit_forum_topic()nameparameter oftelegram.Bot.edit_general_forum_topic()
- Type:
int
- MIN_NAME_LENGTH = 1[source]¶
Minimum length of a
strpassed as:nameparameter oftelegram.Bot.create_forum_topic()nameparameter oftelegram.Bot.edit_forum_topic()nameparameter oftelegram.Bot.edit_general_forum_topic()
- Type:
int
- class telegram.constants.GiftLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
send_gift(). The enum members of this enumeration are instances ofintand can be treated as such.Added in version 21.8.
- MAX_TEXT_LENGTH = 128[source]¶
Maximum number of characters in a
strpassed as thetextparameter ofsend_gift().Changed in version 21.11: Updated Value to 128 based on Bot API 8.3
- Type:
int
- class telegram.constants.GiveawayLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.Giveawayand related classes. The enum members of this enumeration are instances ofintand can be treated as such.Added in version 20.8.
- MAX_WINNERS = 100[source]¶
Maximum number of winners allowed for
telegram.GiveawayWinners.winners.- Type:
int
- class telegram.constants.InlineKeyboardButtonLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.InlineKeyboardButton. The enum members of this enumeration are instances ofintand can be treated as such.Added in version 20.0.
- MAX_CALLBACK_DATA = 64[source]¶
Maximum length allowed for
callback_dataparameter oftelegram.InlineKeyboardButton- Type:
int
- MAX_COPY_TEXT = 256[source]¶
Maximum length allowed for
textparameter oftelegram.CopyTextButton- Type:
int
- MIN_CALLBACK_DATA = 1[source]¶
Minimum length allowed for
callback_dataparameter oftelegram.InlineKeyboardButton- Type:
int
- MIN_COPY_TEXT = 1[source]¶
Minimum length allowed for
textparameter oftelegram.CopyTextButton- Type:
int
- class telegram.constants.InlineKeyboardMarkupLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.InlineKeyboardMarkup/telegram.Bot.send_message()& friends. The enum members of this enumeration are instances ofintand can be treated as such.Added in version 20.0.
- class telegram.constants.InlineQueryLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.InlineQuery/telegram.Bot.answer_inline_query(). The enum members of this enumeration are instances ofintand can be treated as such.Added in version 20.0.
Changed in version 22.0: Removed deprecated attributes
InlineQueryLimit.MIN_SWITCH_PM_TEXT_LENGTHandInlineQueryLimit.MAX_SWITCH_PM_TEXT_LENGTH. Please instead useInlineQueryResultsButtonLimit.MIN_START_PARAMETER_LENGTHandInlineQueryResultsButtonLimit.MAX_START_PARAMETER_LENGTH.- MAX_OFFSET_LENGTH = 64[source]¶
Maximum number of bytes in a
strpassed as thenext_offsetparameter oftelegram.Bot.answer_inline_query().- Type:
int
- MAX_QUERY_LENGTH = 256[source]¶
Maximum number of characters in a
strpassed as thequeryparameter oftelegram.InlineQuery.- Type:
int
- RESULTS = 50[source]¶
Maximum number of results that can be passed to
telegram.Bot.answer_inline_query().- Type:
int
- class telegram.constants.InlineQueryResultLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.InlineQueryResultand its subclasses. The enum members of this enumeration are instances ofintand can be treated as such.Added in version 20.0.
- MAX_ID_LENGTH = 64[source]¶
Maximum number of bytes in a
strpassed as theidparameter oftelegram.InlineQueryResultand its subclasses- Type:
int
- MIN_ID_LENGTH = 1[source]¶
Minimum number of bytes in a
strpassed as theidparameter oftelegram.InlineQueryResultand its subclasses- Type:
int
- class telegram.constants.InlineQueryResultType(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available types of
telegram.InlineQueryResult. The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 20.0.
- ARTICLE = 'article'[source]¶
Type of
telegram.InlineQueryResultArticle.- Type:
str
- AUDIO = 'audio'[source]¶
Type of
telegram.InlineQueryResultAudioandtelegram.InlineQueryResultCachedAudio.- Type:
str
- CONTACT = 'contact'[source]¶
Type of
telegram.InlineQueryResultContact.- Type:
str
- DOCUMENT = 'document'[source]¶
Type of
telegram.InlineQueryResultDocumentandtelegram.InlineQueryResultCachedDocument.- Type:
str
- GAME = 'game'[source]¶
Type of
telegram.InlineQueryResultGame.- Type:
str
- GIF = 'gif'[source]¶
Type of
telegram.InlineQueryResultGifandtelegram.InlineQueryResultCachedGif.- Type:
str
- LOCATION = 'location'[source]¶
Type of
telegram.InlineQueryResultLocation.- Type:
str
- MPEG4GIF = 'mpeg4_gif'[source]¶
Type of
telegram.InlineQueryResultMpeg4Gifandtelegram.InlineQueryResultCachedMpeg4Gif.- Type:
str
- PHOTO = 'photo'[source]¶
Type of
telegram.InlineQueryResultPhotoandtelegram.InlineQueryResultCachedPhoto.- Type:
str
- STICKER = 'sticker'[source]¶
Type of and
telegram.InlineQueryResultCachedSticker.- Type:
str
- VENUE = 'venue'[source]¶
Type of
telegram.InlineQueryResultVenue.- Type:
str
- VIDEO = 'video'[source]¶
Type of
telegram.InlineQueryResultVideoandtelegram.InlineQueryResultCachedVideo.- Type:
str
- VOICE = 'voice'[source]¶
Type of
telegram.InlineQueryResultVoiceandtelegram.InlineQueryResultCachedVoice.- Type:
str
- class telegram.constants.InlineQueryResultsButtonLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.InlineQueryResultsButton. The enum members of this enumeration are instances ofintand can be treated as such.Added in version 20.3.
- MAX_START_PARAMETER_LENGTH = 64[source]¶
Maximum number of characters in a
strpassed as thestart_parameterparameter oftelegram.InlineQueryResultsButton().- Type:
int
- MIN_START_PARAMETER_LENGTH = 1[source]¶
Minimum number of characters in a
strpassed as thestart_parameterparameter oftelegram.InlineQueryResultsButton().- Type:
int
- class telegram.constants.InputChecklistLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.InputChecklist/telegram.InputChecklistTask. The enum members of this enumeration are instances ofintand can be treated as such.Added in version 22.3.
- MAX_TASK_NUMBER = 30[source]¶
Maximum number of tasks passed as
tasksparameter oftelegram.InputChecklistTask- Type:
int
- MAX_TEXT_LENGTH = 100[source]¶
Maximum number of characters in a
strpassed astextparameter oftelegram.InputChecklistTask- Type:
int
- MAX_TITLE_LENGTH = 255[source]¶
Maximum number of characters in a
strpassed astitleparameter oftelegram.InputChecklist- Type:
int
- MIN_TASK_NUMBER = 1[source]¶
Minimum number of tasks passed as
tasksparameter oftelegram.InputChecklist- Type:
int
- MIN_TEXT_LENGTH = 1[source]¶
Minimum number of characters in a
strpassed astextparameter oftelegram.InputChecklistTask- Type:
int
- MIN_TITLE_LENGTH = 1[source]¶
Minimum number of characters in a
strpassed astitleparameter oftelegram.InputChecklist- Type:
int
- class telegram.constants.InputMediaType(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available types of
telegram.InputMedia. The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 20.0.
- ANIMATION = 'animation'[source]¶
Type of
telegram.InputMediaAnimation.- Type:
str
- AUDIO = 'audio'[source]¶
Type of
telegram.InputMediaAudio.- Type:
str
- DOCUMENT = 'document'[source]¶
Type of
telegram.InputMediaDocument.- Type:
str
- PHOTO = 'photo'[source]¶
Type of
telegram.InputMediaPhoto.- Type:
str
- VIDEO = 'video'[source]¶
Type of
telegram.InputMediaVideo.- Type:
str
- class telegram.constants.InputPaidMediaType(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available types of
telegram.InputPaidMedia. The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 21.4.
- PHOTO = 'photo'[source]¶
Type of
telegram.InputMediaPhoto.- Type:
str
- VIDEO = 'video'[source]¶
Type of
telegram.InputMediaVideo.- Type:
str
- class telegram.constants.InputProfilePhotoType(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available types of
telegram.InputProfilePhoto. The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 22.1.
- ANIMATED = 'animated'[source]¶
Type of
telegram.InputProfilePhotoAnimated.- Type:
str
- STATIC = 'static'[source]¶
Type of
telegram.InputProfilePhotoStatic.- Type:
str
- class telegram.constants.InputStoryContentLimit(*values)[source]¶
Bases:
str,enum.EnumThis enum contains limitations for
telegram.InputStoryContentPhoto/telegram.InputStoryContentVideo. The enum members of this enumeration are instances ofintand can be treated as such.Added in version 22.1.
- MAX_VIDEO_DURATION = '60'[source]¶
Maximum duration of the video to be passed to
durationparameter oftelegram.InputStoryContentVideo.- Type:
int
- PHOTOSIZE_UPLOAD = '10000000'[source]¶
Maximum file size of the photo to be passed to
photoparameter oftelegram.InputStoryContentPhotoin Bytes.- Type:
int
- PHOTO_HEIGHT = '1920'[source]¶
Vertical resolution of the video to be passed to
photoparameter oftelegram.InputStoryContentPhoto.- Type:
int
- PHOTO_WIDTH = '1080'[source]¶
Horizontal resolution of the photo to be passed to
photoparameter oftelegram.InputStoryContentPhoto.- Type:
int
- VIDEOSIZE_UPLOAD = '30000000'[source]¶
Maximum file size of the video to be passed to
videoparameter oftelegram.InputStoryContentVideoin Bytes.- Type:
int
- VIDEO_HEIGHT = '1080'[source]¶
Vertical resolution of the video to be passed to
videoparameter oftelegram.InputStoryContentVideo.- Type:
int
- VIDEO_WIDTH = '720'[source]¶
Horizontal resolution of the video to be passed to
videoparameter oftelegram.InputStoryContentVideo.- Type:
int
- class telegram.constants.InputStoryContentType(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available types of
telegram.InputStoryContent. The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 22.1.
- PHOTO = 'photo'[source]¶
Type of
telegram.InputStoryContentPhoto.- Type:
str
- VIDEO = 'video'[source]¶
Type of
telegram.InputStoryContentVideo.- Type:
str
- class telegram.constants.InvoiceLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.InputInvoiceMessageContent,telegram.Bot.send_invoice(), andtelegram.Bot.create_invoice_link(). The enum members of this enumeration are instances ofintand can be treated as such.Added in version 20.0.
- MAX_DESCRIPTION_LENGTH = 255[source]¶
Maximum number of characters in a
strpassed as:descriptionparameter oftelegram.InputInvoiceMessageContentdescriptionparameter oftelegram.Bot.send_invoice().descriptionparameter oftelegram.Bot.create_invoice_link().
- Type:
int
- MAX_PAYLOAD_LENGTH = 128[source]¶
Maximum amount of bytes in a
strpassed as:payloadparameter oftelegram.InputInvoiceMessageContentpayloadparameter oftelegram.Bot.send_invoice().payloadparameter oftelegram.Bot.create_invoice_link().payloadparameter oftelegram.Bot.send_paid_media().
- Type:
int
- MAX_STAR_COUNT = 25000[source]¶
Maximum amount of starts that must be paid to buy access to a paid media passed as
star_countparameter oftelegram.Bot.send_paid_media().Added in version 21.6.
Changed in version 22.1: Bot API 9.0 changed the value to 10000.
Changed in version 22.6: Bot API 9.3 changed the value to 25000.
- Type:
int
- MAX_TIP_AMOUNTS = 4[source]¶
Maximum length of a
Sequencepassed as:suggested_tip_amountsparameter oftelegram.Bot.send_invoice().suggested_tip_amountsparameter oftelegram.Bot.create_invoice_link().
- Type:
int
- MAX_TITLE_LENGTH = 32[source]¶
Maximum number of characters in a
strpassed as:titleparameter oftelegram.InputInvoiceMessageContenttitleparameter oftelegram.Bot.send_invoice().titleparameter oftelegram.Bot.create_invoice_link().
- Type:
int
- MIN_DESCRIPTION_LENGTH = 1[source]¶
Minimum number of characters in a
strpassed as:descriptionparameter oftelegram.InputInvoiceMessageContentdescriptionparameter oftelegram.Bot.send_invoice().descriptionparameter oftelegram.Bot.create_invoice_link().
- Type:
int
- MIN_PAYLOAD_LENGTH = 1[source]¶
Minimum amount of bytes in a
strpassed as:payloadparameter oftelegram.InputInvoiceMessageContentpayloadparameter oftelegram.Bot.send_invoice().payloadparameter oftelegram.Bot.create_invoice_link().
- Type:
int
- MIN_STAR_COUNT = 1[source]¶
Minimum amount of starts that must be paid to buy access to a paid media passed as
star_countparameter oftelegram.Bot.send_paid_media().Added in version 21.6.
- Type:
int
- MIN_TITLE_LENGTH = 1[source]¶
Minimum number of characters in a
strpassed as:titleparameter oftelegram.InputInvoiceMessageContenttitleparameter oftelegram.Bot.send_invoice().titleparameter oftelegram.Bot.create_invoice_link().
- Type:
int
- SUBSCRIPTION_MAX_PRICE = 10000[source]¶
The maximum price of a subscription created wtih
telegram.Bot.create_invoice_link().Added in version 21.9.
Changed in version 22.1: Bot API 9.0 changed the value to 10000.
- Type:
int
- SUBSCRIPTION_PERIOD = 2592000[source]¶
The period of time for which the subscription is active before the next payment, passed as
subscription_periodparameter oftelegram.Bot.create_invoice_link().Added in version 21.8.
- Type:
int
- class telegram.constants.KeyboardButtonRequestUsersLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.KeyboardButtonRequestUsers. The enum members of this enumeration are instances ofintand can be treated as such.Added in version 20.8.
- MAX_QUANTITY = 10[source]¶
Maximum value allowed for
max_quantityparameter oftelegram.KeyboardButtonRequestUsers.- Type:
int
- MIN_QUANTITY = 1[source]¶
Minimum value allowed for
max_quantityparameter oftelegram.KeyboardButtonRequestUsers.- Type:
int
- class telegram.constants.KeyboardButtonStyle(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available button styles for
telegram.InlineKeyboardButtonandtelegram.KeyboardButton. The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 22.7.
- BLUE = 'primary'[source]¶
Alias for
PRIMARY. Blue button style for thestyleandstyleparameters.- Type:
str
- DANGER = 'danger'[source]¶
Danger/destructive button style (usually red) for the
styleandstyleparameters.- Type:
str
- GREEN = 'success'[source]¶
Alias for
SUCCESS. Green button style for thestyleandstyleparameters.- Type:
str
- PRIMARY = 'primary'[source]¶
Primary button style (usually blue) for the
styleandstyleparameters.- Type:
str
- class telegram.constants.LocationLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.Location/telegram.ChatLocation/telegram.Bot.edit_message_live_location()/telegram.Bot.send_location(). The enum members of this enumeration are instances ofintand can be treated as such.Added in version 20.0.
- HORIZONTAL_ACCURACY = 1500[source]¶
Maximum value allowed for:
horizontal_accuracyparameter oftelegram.Locationhorizontal_accuracyparameter oftelegram.InlineQueryResultLocationhorizontal_accuracyparameter oftelegram.InputLocationMessageContenthorizontal_accuracyparameter oftelegram.Bot.edit_message_live_location()horizontal_accuracyparameter oftelegram.Bot.send_location()
- Type:
int
- LIVE_PERIOD_FOREVER = 2147483647[source]¶
Value for live locations that can be edited indefinitely. Passed in:
live_periodparameter oftelegram.InlineQueryResultLocationlive_periodparameter oftelegram.InputLocationMessageContentlive_periodparameter oftelegram.Bot.edit_message_live_location()live_periodparameter oftelegram.Bot.send_location()
Added in version 21.2.
- Type:
int
- MAX_CHAT_LOCATION_ADDRESS = 64[source]¶
Minimum value allowed for
addressparameter oftelegram.ChatLocation- Type:
int
- MAX_HEADING = 360[source]¶
Maximum value allowed for:
headingparameter oftelegram.Locationheadingparameter oftelegram.InlineQueryResultLocationheadingparameter oftelegram.InputLocationMessageContentheadingparameter oftelegram.Bot.edit_message_live_location()headingparameter oftelegram.Bot.send_location()
- Type:
int
- MAX_LIVE_PERIOD = 86400[source]¶
Maximum value allowed for:
live_periodparameter oftelegram.InlineQueryResultLocationlive_periodparameter oftelegram.InputLocationMessageContentlive_periodparameter oftelegram.Bot.edit_message_live_location()live_periodparameter oftelegram.Bot.send_location()
- Type:
int
- MAX_PROXIMITY_ALERT_RADIUS = 100000[source]¶
Maximum value allowed for:
proximity_alert_radiusparameter oftelegram.InlineQueryResultLocationproximity_alert_radiusparameter oftelegram.InputLocationMessageContentproximity_alert_radiusparameter oftelegram.Bot.edit_message_live_location()proximity_alert_radiusparameter oftelegram.Bot.send_location()
- Type:
int
- MIN_CHAT_LOCATION_ADDRESS = 1[source]¶
Minimum value allowed for
addressparameter oftelegram.ChatLocation- Type:
int
- MIN_HEADING = 1[source]¶
Minimum value allowed for:
headingparameter oftelegram.Locationheadingparameter oftelegram.InlineQueryResultLocationheadingparameter oftelegram.InputLocationMessageContentheadingparameter oftelegram.Bot.edit_message_live_location()headingparameter oftelegram.Bot.send_location()
- Type:
int
- MIN_LIVE_PERIOD = 60[source]¶
Minimum value allowed for:
live_periodparameter oftelegram.InlineQueryResultLocationlive_periodparameter oftelegram.InputLocationMessageContentlive_periodparameter oftelegram.Bot.edit_message_live_location()live_periodparameter oftelegram.Bot.send_location()
- Type:
int
- MIN_PROXIMITY_ALERT_RADIUS = 1[source]¶
Minimum value allowed for:
proximity_alert_radiusparameter oftelegram.InlineQueryResultLocationproximity_alert_radiusparameter oftelegram.InputLocationMessageContentproximity_alert_radiusparameter oftelegram.Bot.edit_message_live_location()proximity_alert_radiusparameter oftelegram.Bot.send_location()
- Type:
int
- class telegram.constants.MaskPosition(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available positions for
telegram.MaskPosition. The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 20.0.
- class telegram.constants.MediaGroupLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.Bot.send_media_group(). The enum members of this enumeration are instances ofintand can be treated as such.Added in version 20.0.
- MAX_MEDIA_LENGTH = 10[source]¶
Maximum length of a
listpassed as themediaparameter oftelegram.Bot.send_media_group().- Type:
int
- MIN_MEDIA_LENGTH = 2[source]¶
Minimum length of a
listpassed as themediaparameter oftelegram.Bot.send_media_group().- Type:
int
- class telegram.constants.MenuButtonType(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available types of
telegram.MenuButton. The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 20.0.
- COMMANDS = 'commands'[source]¶
The type of
telegram.MenuButtonCommands.- Type:
str
- DEFAULT = 'default'[source]¶
The type of
telegram.MenuButtonDefault.- Type:
str
- WEB_APP = 'web_app'[source]¶
The type of
telegram.MenuButtonWebApp.- Type:
str
- class telegram.constants.MessageAttachmentType(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available types of
telegram.Messagethat can be seen as attachment. The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 20.0.
- ANIMATION = 'animation'[source]¶
Messages with
telegram.Message.animation.- Type:
str
- AUDIO = 'audio'[source]¶
Messages with
telegram.Message.audio.- Type:
str
- CONTACT = 'contact'[source]¶
Messages with
telegram.Message.contact.- Type:
str
- DICE = 'dice'[source]¶
Messages with
telegram.Message.dice.- Type:
str
- DOCUMENT = 'document'[source]¶
Messages with
telegram.Message.document.- Type:
str
- GAME = 'game'[source]¶
Messages with
telegram.Message.game.- Type:
str
- INVOICE = 'invoice'[source]¶
Messages with
telegram.Message.invoice.- Type:
str
- LOCATION = 'location'[source]¶
Messages with
telegram.Message.location.- Type:
str
- PAID_MEDIA = 'paid_media'[source]¶
Messages with
telegram.Message.paid_media.Added in version 21.4.
- Type:
str
- PASSPORT_DATA = 'passport_data'[source]¶
Messages with
telegram.Message.passport_data.- Type:
str
- PHOTO = 'photo'[source]¶
Messages with
telegram.Message.photo.- Type:
str
- POLL = 'poll'[source]¶
Messages with
telegram.Message.poll.- Type:
str
- STICKER = 'sticker'[source]¶
Messages with
telegram.Message.sticker.- Type:
str
- STORY = 'story'[source]¶
Messages with
telegram.Message.story.- Type:
str
- SUCCESSFUL_PAYMENT = 'successful_payment'[source]¶
Messages with
telegram.Message.successful_payment.- Type:
str
- VENUE = 'venue'[source]¶
Messages with
telegram.Message.venue.- Type:
str
- VIDEO = 'video'[source]¶
Messages with
telegram.Message.video.- Type:
str
- VIDEO_NOTE = 'video_note'[source]¶
Messages with
telegram.Message.video_note.- Type:
str
- VOICE = 'voice'[source]¶
Messages with
telegram.Message.voice.- Type:
str
- class telegram.constants.MessageEntityDateTimeFormats(*values)[source]¶
Bases:
str,enum.EnumThis enum contains all possible formats for
telegram.MessageEntity.date_time_format. Please read date-time entity formatting for more details. The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 22.7.
- LOCALIZED_WEEKDAY = 'w'[source]¶
Displays the day of the week in the user’s localized language.
- Type:
str
- LOCALIZED_WEEKDAY_LONG_DATE = 'wD'[source]¶
Displays the day of the week in the user’s localized language and the date in long form.
- Type:
str
- LOCALIZED_WEEKDAY_LONG_DATE_LONG_TIME = 'wDT'[source]¶
Displays the day of the week in the user’s localized language, the date in long form and the time in long form.
- Type:
str
- LOCALIZED_WEEKDAY_LONG_DATE_SHORT_TIME = 'wDt'[source]¶
Displays the day of the week in the user’s localized language, the date in long form and the time in short form.
- Type:
str
- LOCALIZED_WEEKDAY_LONG_TIME = 'wT'[source]¶
Displays the day of the week in the user’s localized language and the time in long form.
- Type:
str
- LOCALIZED_WEEKDAY_SHORT_DATE = 'wd'[source]¶
Displays the day of the week in the user’s localized language and the date in short form.
- Type:
str
- LOCALIZED_WEEKDAY_SHORT_DATE_LONG_TIME = 'wdT'[source]¶
Displays the day of the week in the user’s localized language, the date in short form and the time in long form.
- Type:
str
- LOCALIZED_WEEKDAY_SHORT_DATE_SHORT_TIME = 'wdt'[source]¶
Displays the day of the week in the user’s localized language, the date in short form and the time in short form.
- Type:
str
- LOCALIZED_WEEKDAY_SHORT_TIME = 'wt'[source]¶
Displays the day of the week in the user’s localized language and the time in short form.
- Type:
str
- LONG_DATE_LONG_TIME = 'DT'[source]¶
Displays the date in long form and the time in long form.
- Type:
str
- LONG_DATE_SHORT_TIME = 'Dt'[source]¶
Displays the date in long form and the time in short form.
- Type:
str
- SHORT_DATE_LONG_TIME = 'dT'[source]¶
Displays the date in short form and the time in long form.
- Type:
str
- class telegram.constants.MessageEntityType(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available types of
telegram.MessageEntity. The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 20.0.
- BLOCKQUOTE = 'blockquote'[source]¶
Message entities representing a block quotation.
Added in version 20.8.
- Type:
str
- CUSTOM_EMOJI = 'custom_emoji'[source]¶
Message entities representing inline custom emoji stickers.
Added in version 20.0.
- Type:
str
- DATE_TIME = 'date_time'[source]¶
Message entities representing formatted date and time.
Added in version 22.7.
- Type:
str
- EXPANDABLE_BLOCKQUOTE = 'expandable_blockquote'[source]¶
Message entities representing collapsed-by-default block quotation.
Added in version 21.3.
- Type:
str
- STRIKETHROUGH = 'strikethrough'[source]¶
Message entities representing strikethrough text.
- Type:
str
- class telegram.constants.MessageLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.Message/telegram.InputTextMessageContent/telegram.Bot.send_message()& friends. The enum members of this enumeration are instances ofintand can be treated as such.Added in version 20.0.
- CAPTION_LENGTH = 1024[source]¶
Maximum number of characters in a
strpassed as:captionparameter oftelegram.Messagecaptionparameter oftelegram.InputMediaand its subclassescaptionparameter of subclasses oftelegram.InlineQueryResultcaptionparameter oftelegram.Bot.send_photo(),telegram.Bot.send_audio(),telegram.Bot.send_document(),telegram.Bot.send_video(),telegram.Bot.send_animation(),telegram.Bot.send_voice(),telegram.Bot.edit_message_caption(),telegram.Bot.copy_message()
- Type:
int
- MAX_TEXT_LENGTH = 4096[source]¶
Maximum number of characters in a
strpassed as:textparameter oftelegram.Gametextparameter oftelegram.Messagemessage_textparameter oftelegram.InputTextMessageContenttextparameter oftelegram.Bot.send_message()textparameter oftelegram.Bot.edit_message_text()textparameter oftelegram.Bot.send_message_draft()
- Type:
int
- MESSAGE_ENTITIES = 100[source]¶
Maximum number of entities that can be displayed in a message. Further entities will simply be ignored by Telegram.
Note
This value is undocumented and might be changed by Telegram.
- Type:
int
- MIN_TEXT_LENGTH = 1[source]¶
Minimum number of characters in a
strpassed as:message_textparameter oftelegram.InputTextMessageContent.textparameter oftelegram.Bot.edit_message_text().textparameter oftelegram.Bot.send_message_draft().
- Type:
int
- class telegram.constants.MessageOriginType(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available types of
telegram.MessageOrigin. The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 20.8.
- CHANNEL = 'channel'[source]¶
A
telegram.MessageOriginwho is sent by a channel.- Type:
str
- CHAT = 'chat'[source]¶
A
telegram.MessageOriginwho is sent by a chat.- Type:
str
- HIDDEN_USER = 'hidden_user'[source]¶
A
telegram.MessageOriginwho is sent by a hidden user.- Type:
str
- USER = 'user'[source]¶
A
telegram.MessageOriginwho is sent by an user.- Type:
str
- class telegram.constants.MessageType(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available types of
telegram.Message. Here, a “type” means a kind of message that is visually distinct from other kinds of messages in the Telegram app. In particular, auxiliary attributes that can be present for multiple types of messages are not considered in this enumeration.The enum members of this enumeration are instances of
strand can be treated as such.Added in version 20.0.
- ANIMATION = 'animation'[source]¶
Messages with
telegram.Message.animation.- Type:
str
- AUDIO = 'audio'[source]¶
Messages with
telegram.Message.audio.- Type:
str
- BOOST_ADDED = 'boost_added'[source]¶
Messages with
telegram.Message.boost_added.Added in version 21.0.
- Type:
str
- BUSINESS_CONNECTION_ID = 'business_connection_id'[source]¶
Messages with
telegram.Message.business_connection_id.Added in version 21.1.
- Type:
str
- CHANNEL_CHAT_CREATED = 'channel_chat_created'[source]¶
Messages with
telegram.Message.channel_chat_created.- Type:
str
- CHAT_BACKGROUND_SET = 'chat_background_set'[source]¶
Messages with
telegram.Message.chat_background_set.Added in version 21.2.
- Type:
str
- CHAT_OWNER_CHANGED = 'chat_owner_changed'[source]¶
Messages with
telegram.Message.chat_owner_changed.Added in version 22.7.
- Type:
str
- CHAT_OWNER_LEFT = 'chat_owner_left'[source]¶
Messages with
telegram.Message.chat_owner_left.Added in version 22.7.
- Type:
str
- CHAT_SHARED = 'chat_shared'[source]¶
Messages with
telegram.Message.chat_shared.Added in version 20.8.
- Type:
str
- CHECKLIST = 'checklist'[source]¶
Messages with
telegram.Message.checklist.Added in version 22.3.
- Type:
str
- CHECKLIST_TASKS_ADDED = 'checklist_tasks_added'[source]¶
Messages with
telegram.Message.checklist_tasks_added.Added in version 22.3.
- Type:
str
- CHECKLIST_TASKS_DONE = 'checklist_tasks_done'[source]¶
Messages with
telegram.Message.checklist_tasks_done.Added in version 22.3.
- Type:
str
- CONNECTED_WEBSITE = 'connected_website'[source]¶
Messages with
telegram.Message.connected_website.- Type:
str
- CONTACT = 'contact'[source]¶
Messages with
telegram.Message.contact.- Type:
str
- DELETE_CHAT_PHOTO = 'delete_chat_photo'[source]¶
Messages with
telegram.Message.delete_chat_photo.- Type:
str
- DICE = 'dice'[source]¶
Messages with
telegram.Message.dice.- Type:
str
- DIRECT_MESSAGE_PRICE_CHANGED = 'direct_message_price_changed'[source]¶
Messages with
telegram.Message.direct_message_price_changed.Added in version 22.3.
- Type:
str
- DOCUMENT = 'document'[source]¶
Messages with
telegram.Message.document.- Type:
str
- EFFECT_ID = 'effect_id'[source]¶
Messages with
telegram.Message.effect_id.Added in version 21.3.
- Type:
str
- FORUM_TOPIC_CLOSED = 'forum_topic_closed'[source]¶
Messages with
telegram.Message.forum_topic_closed.Added in version 20.8.
- Type:
str
- FORUM_TOPIC_CREATED = 'forum_topic_created'[source]¶
Messages with
telegram.Message.forum_topic_created.Added in version 20.8.
- Type:
str
- FORUM_TOPIC_EDITED = 'forum_topic_edited'[source]¶
Messages with
telegram.Message.forum_topic_edited.Added in version 20.8.
- Type:
str
- FORUM_TOPIC_REOPENED = 'forum_topic_reopened'[source]¶
Messages with
telegram.Message.forum_topic_reopened.Added in version 20.8.
- Type:
str
- GAME = 'game'[source]¶
Messages with
telegram.Message.game.- Type:
str
- GENERAL_FORUM_TOPIC_HIDDEN = 'general_forum_topic_hidden'[source]¶
Messages with
telegram.Message.general_forum_topic_hidden.Added in version 20.8.
- Type:
str
- GENERAL_FORUM_TOPIC_UNHIDDEN = 'general_forum_topic_unhidden'[source]¶
Messages with
telegram.Message.general_forum_topic_unhidden.Added in version 20.8.
- Type:
str
- GIFT = 'gift'[source]¶
Messages with
telegram.Message.gift.Added in version 22.1.
- Type:
str
- GIFT_UPGRADE_SENT = 'gift_upgrade_sent'[source]¶
Messages with
telegram.Message.gift_upgrade_sent.Added in version 22.6.
- Type:
str
- GIVEAWAY = 'giveaway'[source]¶
Messages with
telegram.Message.giveaway.Added in version 20.8.
- Type:
str
- GIVEAWAY_COMPLETED = 'giveaway_completed'[source]¶
Messages with
telegram.Message.giveaway_completed.Added in version 20.8.
- Type:
str
- GIVEAWAY_CREATED = 'giveaway_created'[source]¶
Messages with
telegram.Message.giveaway_created.Added in version 20.8.
- Type:
str
- GIVEAWAY_WINNERS = 'giveaway_winners'[source]¶
Messages with
telegram.Message.giveaway_winners.Added in version 20.8.
- Type:
str
- GROUP_CHAT_CREATED = 'group_chat_created'[source]¶
Messages with
telegram.Message.group_chat_created.- Type:
str
- INVOICE = 'invoice'[source]¶
Messages with
telegram.Message.invoice.- Type:
str
- LEFT_CHAT_MEMBER = 'left_chat_member'[source]¶
Messages with
telegram.Message.left_chat_member.- Type:
str
- LOCATION = 'location'[source]¶
Messages with
telegram.Message.location.- Type:
str
- MESSAGE_AUTO_DELETE_TIMER_CHANGED = 'message_auto_delete_timer_changed'[source]¶
Messages with
telegram.Message.message_auto_delete_timer_changed.- Type:
str
- MIGRATE_TO_CHAT_ID = 'migrate_to_chat_id'[source]¶
Messages with
telegram.Message.migrate_to_chat_id.- Type:
str
- NEW_CHAT_MEMBERS = 'new_chat_members'[source]¶
Messages with
telegram.Message.new_chat_members.- Type:
str
- NEW_CHAT_PHOTO = 'new_chat_photo'[source]¶
Messages with
telegram.Message.new_chat_photo.- Type:
str
- NEW_CHAT_TITLE = 'new_chat_title'[source]¶
Messages with
telegram.Message.new_chat_title.- Type:
str
- PAID_MEDIA = 'paid_media'[source]¶
Messages with
telegram.Message.paid_media.Added in version 21.4.
- Type:
str
- PAID_MESSAGE_PRICE_CHANGED = 'paid_message_price_changed'[source]¶
Messages with
telegram.Message.paid_message_price_changed.Added in version v22.2.
- Type:
str
- PASSPORT_DATA = 'passport_data'[source]¶
Messages with
telegram.Message.passport_data.- Type:
str
- PHOTO = 'photo'[source]¶
Messages with
telegram.Message.photo.- Type:
str
- PINNED_MESSAGE = 'pinned_message'[source]¶
Messages with
telegram.Message.pinned_message.- Type:
str
- POLL = 'poll'[source]¶
Messages with
telegram.Message.poll.- Type:
str
- PROXIMITY_ALERT_TRIGGERED = 'proximity_alert_triggered'[source]¶
Messages with
telegram.Message.proximity_alert_triggered.- Type:
str
- REFUNDED_PAYMENT = 'refunded_payment'[source]¶
Messages with
telegram.Message.refunded_payment.Added in version 21.4.
- Type:
str
- REPLY_TO_STORY = 'reply_to_story'[source]¶
Messages with
telegram.Message.reply_to_story.Added in version 21.0.
- Type:
str
- SENDER_BOOST_COUNT = 'sender_boost_count'[source]¶
Messages with
telegram.Message.sender_boost_count.Added in version 21.0.
- Type:
str
- SENDER_BUSINESS_BOT = 'sender_business_bot'[source]¶
Messages with
telegram.Message.sender_business_bot.Added in version 21.1.
- Type:
str
- STICKER = 'sticker'[source]¶
Messages with
telegram.Message.sticker.- Type:
str
- STORY = 'story'[source]¶
Messages with
telegram.Message.story.- Type:
str
- SUCCESSFUL_PAYMENT = 'successful_payment'[source]¶
Messages with
telegram.Message.successful_payment.- Type:
str
- SUGGESTED_POST_APPROVAL_FAILED = 'suggested_post_approval_failed'[source]¶
Messages with
telegram.Message.suggested_post_approval_failed.Added in version 22.4.
- Type:
str
- SUGGESTED_POST_APPROVED = 'suggested_post_approved'[source]¶
Messages with
telegram.Message.suggested_post_approved.Added in version 22.4.
- Type:
str
- SUGGESTED_POST_DECLINED = 'suggested_post_declined'[source]¶
Messages with
telegram.Message.suggested_post_declined.Added in version 22.4.
- Type:
str
- SUGGESTED_POST_INFO = 'suggested_post_info'[source]¶
Messages with
telegram.Message.suggested_post_info.Added in version 22.4.
- Type:
str
- SUGGESTED_POST_PAID = 'suggested_post_paid'[source]¶
Messages with
telegram.Message.suggested_post_paid.Added in version 22.4.
- Type:
str
- SUGGESTED_POST_REFUNDED = 'suggested_post_refunded'[source]¶
Messages with
telegram.Message.suggested_post_refunded.Added in version 22.4.
- Type:
str
- SUPERGROUP_CHAT_CREATED = 'supergroup_chat_created'[source]¶
Messages with
telegram.Message.supergroup_chat_created.- Type:
str
- TEXT = 'text'[source]¶
Messages with
telegram.Message.text.- Type:
str
- UNIQUE_GIFT = 'unique_gift'[source]¶
Messages with
telegram.Message.unique_gift.Added in version 22.1.
- Type:
str
- USERS_SHARED = 'users_shared'[source]¶
Messages with
telegram.Message.users_shared.Added in version 20.8.
- Type:
str
- VENUE = 'venue'[source]¶
Messages with
telegram.Message.venue.- Type:
str
- VIDEO = 'video'[source]¶
Messages with
telegram.Message.video.- Type:
str
- VIDEO_CHAT_ENDED = 'video_chat_ended'[source]¶
Messages with
telegram.Message.video_chat_ended.- Type:
str
- VIDEO_CHAT_PARTICIPANTS_INVITED = 'video_chat_participants_invited'[source]¶
Messages with
telegram.Message.video_chat_participants_invited.- Type:
str
- VIDEO_CHAT_SCHEDULED = 'video_chat_scheduled'[source]¶
Messages with
telegram.Message.video_chat_scheduled.- Type:
str
- VIDEO_CHAT_STARTED = 'video_chat_started'[source]¶
Messages with
telegram.Message.video_chat_started.- Type:
str
- VIDEO_NOTE = 'video_note'[source]¶
Messages with
telegram.Message.video_note.- Type:
str
- VOICE = 'voice'[source]¶
Messages with
telegram.Message.voice.- Type:
str
- WEB_APP_DATA = 'web_app_data'[source]¶
Messages with
telegram.Message.web_app_data.Added in version 20.8.
- Type:
str
- WRITE_ACCESS_ALLOWED = 'write_access_allowed'[source]¶
Messages with
telegram.Message.write_access_allowed.Added in version 20.8.
- Type:
str
- class telegram.constants.Nanostar(*values)[source]¶
Bases:
float,enum.EnumThis enum contains constants for
nanostar_amountparameter oftelegram.StarAmount,telegram.StarTransactionandtelegram.AffiliateInfo. The enum members of this enumeration are instances offloatand can be treated as such.Added in version 22.1.
- VALUE = 1e-09[source]¶
The value of one nanostar as used in
telegram.StarTransaction.nanostar_amountparameter oftelegram.StarTransaction,telegram.StarAmount.nanostar_amountparameter oftelegram.StarAmountandtelegram.AffiliateInfo.nanostar_amountparameter oftelegram.AffiliateInfo- Type:
float
- class telegram.constants.NanostarLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
nanostar_amountparameter oftelegram.AffiliateInfo,telegram.StarTransactionandtelegram.StarAmount. The enum members of this enumeration are instances ofintand can be treated as such.Added in version 22.1.
- MAX_AMOUNT = 999999999[source]¶
Maximum value allowed for
nanostar_amountparameter oftelegram.StarTransaction,nanostar_amountparameter oftelegram.AffiliateInfoandnanostar_amountparameter oftelegram.StarAmount.- Type:
int
- MIN_AMOUNT = -999999999[source]¶
Minimum value allowed for
nanostar_amountparameter oftelegram.AffiliateInfoandnanostar_amountparameter oftelegram.StarAmount.- Type:
int
- class telegram.constants.OwnedGiftType(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available types of
telegram.OwnedGift. The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 22.1.
- class telegram.constants.PaidMediaType(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available types of
telegram.PaidMedia. The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 21.4.
- PHOTO = 'photo'[source]¶
The type of
telegram.PaidMediaPhoto.- Type:
str
- PREVIEW = 'preview'[source]¶
The type of
telegram.PaidMediaPreview.- Type:
str
- VIDEO = 'video'[source]¶
The type of
telegram.PaidMediaVideo.- Type:
str
- class telegram.constants.ParseMode(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available parse modes. The enum members of this enumeration are instances of
strand can be treated as such.Added in version 20.0.
- MARKDOWN = 'Markdown'[source]¶
Markdown parse mode.
Note
MARKDOWNis a legacy mode, retained by Telegram for backward compatibility. You should useMARKDOWN_V2instead.- Type:
str
- class telegram.constants.PollLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.Poll/telegram.PollOption/telegram.Bot.send_poll(). The enum members of this enumeration are instances ofintand can be treated as such.Added in version 20.0.
- MAX_EXPLANATION_LENGTH = 200[source]¶
Maximum number of characters in a
strpassed as theexplanationparameter oftelegram.Polland theexplanationparameter oftelegram.Bot.send_poll().- Type:
int
- MAX_EXPLANATION_LINE_FEEDS = 2[source]¶
Maximum number of line feeds in a
strpassed as theexplanationparameter oftelegram.Bot.send_poll()after entities parsing.- Type:
int
- MAX_OPEN_PERIOD = 600[source]¶
Maximum value allowed for the
open_periodparameter oftelegram.Bot.send_poll(). Also used in theclose_dateparameter oftelegram.Bot.send_poll().- Type:
int
- MAX_OPTION_LENGTH = 100[source]¶
Maximum length of each
strpassed in alistto theoptionsparameter oftelegram.Bot.send_poll().- Type:
int
- MAX_OPTION_NUMBER = 12[source]¶
Maximum number of strings passed in a
listto theoptionsparameter oftelegram.Bot.send_poll().Changed in version 22.3: This value was changed from
10to12in accordance to Bot API 9.1.- Type:
int
- MAX_QUESTION_LENGTH = 300[source]¶
Maximum value allowed for the
questionparameter oftelegram.Polland thequestionparameter oftelegram.Bot.send_poll().- Type:
int
- MIN_OPEN_PERIOD = 5[source]¶
Minimum value allowed for the
open_periodparameter oftelegram.Bot.send_poll(). Also used in theclose_dateparameter oftelegram.Bot.send_poll().- Type:
int
- MIN_OPTION_LENGTH = 1[source]¶
Minimum length of each
strpassed in alistto theoptionsparameter oftelegram.Bot.send_poll().- Type:
int
- MIN_OPTION_NUMBER = 2[source]¶
Minimum number of strings passed in a
listto theoptionsparameter oftelegram.Bot.send_poll().- Type:
int
- MIN_QUESTION_LENGTH = 1[source]¶
Minimum value allowed for the
questionparameter oftelegram.Polland thequestionparameter oftelegram.Bot.send_poll().- Type:
int
- class telegram.constants.PollType(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available types for
telegram.Poll/telegram.Bot.send_poll(). The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 20.0.
- class telegram.constants.PollingLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.Bot.get_updates.limit. The enum members of this enumeration are instances ofintand can be treated as such.Added in version 20.0.
- MAX_LIMIT = 100[source]¶
Maximum value allowed for the
limitparameter oftelegram.Bot.get_updates().- Type:
int
- MIN_LIMIT = 1[source]¶
Minimum value allowed for the
limitparameter oftelegram.Bot.get_updates().- Type:
int
- class telegram.constants.PremiumSubscription(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
gift_premium_subscription(). The enum members of this enumeration are instances ofintand can be treated as such.Added in version 22.1.
- MAX_TEXT_LENGTH = 128[source]¶
Maximum number of characters in a
strpassed as thetextparameter ofgift_premium_subscription().- Type:
int
- MONTH_COUNT_SIX = 6[source]¶
Possible value for
month_countparameter ofgift_premium_subscription(); number of months the Premium subscription will be active for.- Type:
int
- MONTH_COUNT_THREE = 3[source]¶
Possible value for
month_countparameter ofgift_premium_subscription(); number of months the Premium subscription will be active for.- Type:
int
- MONTH_COUNT_TWELVE = 12[source]¶
Possible value for
month_countparameter ofgift_premium_subscription(); number of months the Premium subscription will be active for.- Type:
int
- STARS_SIX_MONTHS = 1500[source]¶
Number of Telegram Stars to pay for a Premium subscription of
6months period. Relevant forstar_countparameter ofgift_premium_subscription().- Type:
int
- STARS_THREE_MONTHS = 1000[source]¶
Number of Telegram Stars to pay for a Premium subscription of
3months period. Relevant forstar_countparameter ofgift_premium_subscription().- Type:
int
- STARS_TWELVE_MONTHS = 2500[source]¶
Number of Telegram Stars to pay for a Premium subscription of
12months period. Relevant forstar_countparameter ofgift_premium_subscription().- Type:
int
- class telegram.constants.ProfileAccentColor(*values)[source]¶
Bases:
EnumThis enum contains the available accent colors for
telegram.ChatFullInfo.profile_accent_color_id. The members of this enum are named tuples with the following attributes:identifier(int): The identifier of the accent color.name(str): Optional. The name of the accent color.light_colors(tuple[str]): Optional. The light colors of the accent color as HEX value.dark_colors(tuple[str]): Optional. The dark colors of the accent color as HEX value.
Since Telegram gives no exact specification for the accent colors, future accent colors might have a different data type.
Added in version 20.8.
- COLOR_000 = (0, None, (12211792,), (10241344,))[source]¶
Accent color 0. This contains one light color
and one dark color
- COLOR_001 = (1, None, (12745790,), (9723436,))[source]¶
Accent color 1. This contains one light color
and one dark color
- COLOR_002 = (2, None, (9792200,), (7426201,))[source]¶
Accent color 2. This contains one light color
and one dark color
- COLOR_003 = (3, None, (4825941,), (3371323,))[source]¶
Accent color 3. This contains one light color
and one dark color
- COLOR_004 = (4, None, (4102061,), (3702407,))[source]¶
Accent color 4. This contains one light color
and one dark color
- COLOR_005 = (5, None, (5935035,), (4682132,))[source]¶
Accent color 5. This contains one light color
and one dark color
- COLOR_006 = (6, None, (12079992,), (9717603,))[source]¶
Accent color 6. This contains one light color
and one dark color
- COLOR_007 = (7, None, (8358805,), (4412001,))[source]¶
Accent color 7. This contains one light color
and one dark color
- COLOR_008 = (8, None, (13194845, 14253143), (10044227, 11294782))[source]¶
Accent color 8. This contains two light colors
and two dark colors
- COLOR_009 = (9, None, (13595204, 13407283), (9393455, 10580530))[source]¶
Accent color 9. This contains two light colors
and two dark colors
- COLOR_010 = (10, None, (9855700, 12150454), (6506129, 9588898))[source]¶
Accent color 10. This contains two light colors
and two dark colors
- COLOR_011 = (11, None, (4036437, 9021008), (2714179, 6262596))[source]¶
Accent color 11. This contains two light colors
and two dark colors
- COLOR_012 = (12, None, (4036026, 5287320), (3173500, 4102270))[source]¶
Accent color 12. This contains two light colors
and two dark colors
- COLOR_013 = (13, None, (5475266, 5089469), (3694988, 4557729))[source]¶
Accent color 13. This contains two light colors
and two dark colors
- class telegram.constants.ReactionEmoji(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available emojis of
telegram.ReactionTypeEmoji. The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 20.8.
- GRINNING_FACE_WITH_ONE_LARGE_AND_ONE_SMALL_EYE = '🤪'[source]¶
Grinning face with one large and one small eye
- Type:
str
- REVERSED_HAND_WITH_MIDDLE_FINGER_EXTENDED = '🖕'[source]¶
Reversed hand with middle finger extended
- Type:
str
- class telegram.constants.ReactionType(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available types of
telegram.ReactionType. The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 20.8.
- CUSTOM_EMOJI = 'custom_emoji'[source]¶
A
telegram.ReactionTypewith a custom emoji.- Type:
str
- EMOJI = 'emoji'[source]¶
A
telegram.ReactionTypewith a normal emoji.- Type:
str
- PAID = 'paid'[source]¶
A
telegram.ReactionTypewith a paid reaction.Added in version 21.5.
- Type:
str
- class telegram.constants.ReplyLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.ForceReplyandtelegram.ReplyKeyboardMarkup. The enum members of this enumeration are instances ofintand can be treated as such.Added in version 20.0.
- MAX_INPUT_FIELD_PLACEHOLDER = 64[source]¶
Maximum value allowed for
input_field_placeholderparameter oftelegram.ForceReplyandinput_field_placeholderparameter oftelegram.ReplyKeyboardMarkup- Type:
int
- MIN_INPUT_FIELD_PLACEHOLDER = 1[source]¶
Minimum value allowed for
input_field_placeholderparameter oftelegram.ForceReplyandinput_field_placeholderparameter oftelegram.ReplyKeyboardMarkup- Type:
int
- class telegram.constants.RevenueWithdrawalStateType(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available types of
telegram.RevenueWithdrawalState. The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 21.4.
- telegram.constants.SUPPORTED_WEBHOOK_PORTS = [443, 80, 88, 8443][source]¶
Ports supported by
telegram.Bot.set_webhook.url.- Type:
list[
int]
- class telegram.constants.StarTransactionsLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.Bot.get_star_transactionsandtelegram.StarTransaction. The enum members of this enumeration are instances ofintand can be treated as such.Added in version 21.4.
Removed in version 22.3: Removed deprecated attributes
StarTransactionsLimit.NANOSTAR_MIN_AMOUNTandStarTransactionsLimit.NANOSTAR_MAX_AMOUNT. Please instead usetelegram.constants.NanostarLimit.MIN_AMOUNTandtelegram.constants.NanostarLimit.MAX_AMOUNT.- MAX_LIMIT = 100[source]¶
Maximum value allowed for the
limitparameter oftelegram.Bot.get_star_transactions().- Type:
int
- MIN_LIMIT = 1[source]¶
Minimum value allowed for the
limitparameter oftelegram.Bot.get_star_transactions().- Type:
int
- class telegram.constants.StickerFormat(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available formats of
telegram.Stickerin the set. The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 20.2.
- class telegram.constants.StickerLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for various sticker methods, such as
telegram.Bot.create_new_sticker_set(). The enum members of this enumeration are instances ofintand can be treated as such.Added in version 20.0.
- MAX_KEYWORD_LENGTH = 64[source]¶
Maximum number of characters in a search keyword for a sticker, for each item in
keywordssequence oftelegram.Bot.set_sticker_keywords().Added in version 20.2.
- Type:
int
- MAX_NAME_AND_TITLE = 64[source]¶
Maximum number of characters in a
strpassed as thenameparameter or thetitleparameter oftelegram.Bot.create_new_sticker_set().- Type:
int
- MAX_SEARCH_KEYWORDS = 20[source]¶
Maximum number of search keywords for a sticker, passed as the
keywordsparameter oftelegram.Bot.set_sticker_keywords().Added in version 20.2.
- Type:
int
- MAX_STICKER_EMOJI = 20[source]¶
Maximum number of emojis associated with a sticker, passed as the
emoji_listparameter oftelegram.Bot.set_sticker_emoji_list().Added in version 20.2.
- Type:
int
- MIN_NAME_AND_TITLE = 1[source]¶
Minimum number of characters in a
strpassed as thenameparameter or thetitleparameter oftelegram.Bot.create_new_sticker_set().- Type:
int
- MIN_STICKER_EMOJI = 1[source]¶
Minimum number of emojis associated with a sticker, passed as the
emoji_listparameter oftelegram.Bot.set_sticker_emoji_list().Added in version 20.2.
- Type:
int
- class telegram.constants.StickerSetLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for various sticker set methods, such as
telegram.Bot.create_new_sticker_set()andtelegram.Bot.add_sticker_to_set().The enum members of this enumeration are instances of
intand can be treated as such.Added in version 20.2.
- MAX_ANIMATED_STICKERS = 50[source]¶
Maximum number of stickers allowed in an animated or video sticker set, as given in
telegram.Bot.add_sticker_to_set().Deprecated since version 21.1: The animated sticker limit is now 120, the same as
MAX_STATIC_STICKERS.- Type:
int
- MAX_ANIMATED_THUMBNAIL_SIZE = 32[source]¶
Maximum size of the thumbnail if it is a
.TGSor.WEBMin kilobytes, as given intelegram.Bot.set_sticker_set_thumbnail().- Type:
int
- MAX_EMOJI_STICKERS = 200[source]¶
Maximum number of stickers allowed in an emoji sticker set, as given in
telegram.Bot.add_sticker_to_set().- Type:
int
- MAX_INITIAL_STICKERS = 50[source]¶
Maximum number of stickers allowed while creating a sticker set, passed as the
stickersparameter oftelegram.Bot.create_new_sticker_set().- Type:
int
- MAX_STATIC_STICKERS = 120[source]¶
Maximum number of stickers allowed in a static sticker set, as given in
telegram.Bot.add_sticker_to_set().- Type:
int
- MAX_STATIC_THUMBNAIL_SIZE = 128[source]¶
Maximum size of the thumbnail if it is a
.WEBPor.PNGin kilobytes, as given intelegram.Bot.set_sticker_set_thumbnail().- Type:
int
- MIN_INITIAL_STICKERS = 1[source]¶
Minimum number of stickers needed to create a sticker set, passed as the
stickersparameter oftelegram.Bot.create_new_sticker_set().- Type:
int
- STATIC_THUMB_DIMENSIONS = 100[source]¶
Exact height and width of the thumbnail if it is a
.WEBPor.PNGin pixels, as given intelegram.Bot.set_sticker_set_thumbnail().- Type:
int
- class telegram.constants.StickerType(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available types of
telegram.Sticker. The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 20.0.
- class telegram.constants.StoryAreaPositionLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.StoryAreaPosition. The enum members of this enumeration are instances ofintand can be treated as such.Added in version 22.1.
- MAX_ROTATION_ANGLE = 360[source]¶
Maximum value allowed for:
rotation_angleparameter oftelegram.StoryAreaPosition- Type:
int
- class telegram.constants.StoryAreaTypeLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for subclasses of
telegram.StoryAreaType. The enum members of this enumeration are instances ofintand can be treated as such.Added in version 22.1.
- MAX_SUGGESTED_REACTION_AREAS = 5[source]¶
Maximum number of suggested reaction areas that a story can have.
- Type:
int
- class telegram.constants.StoryAreaTypeType(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available types of
telegram.StoryAreaType. The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 22.1.
- LINK = 'link'[source]¶
Type of
telegram.StoryAreaTypeLink.- Type:
str
- LOCATION = 'location'[source]¶
Type of
telegram.StoryAreaTypeLocation.- Type:
str
- SUGGESTED_REACTION = 'suggested_reaction'[source]¶
Type of
telegram.StoryAreaTypeSuggestedReaction.- Type:
str
- UNIQUE_GIFT = 'unique_gift'[source]¶
Type of
telegram.StoryAreaTypeUniqueGift.- Type:
str
- WEATHER = 'weather'[source]¶
Type of
telegram.StoryAreaTypeWeather.- Type:
str
- class telegram.constants.StoryLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
post_story()andedit_story(). The enum members of this enumeration are instances ofintand can be treated as such.Added in version 22.1.
- ACTIVITY_ONE_DAY = 86400[source]¶
Possible value for
active_period`parameter oftelegram.Bot.post_story().- Type:
int
- ACTIVITY_SIX_HOURS = 21600[source]¶
Possible value for
active_period`parameter oftelegram.Bot.post_story().- Type:
int
- ACTIVITY_TWELVE_HOURS = 43200[source]¶
Possible value for
active_period`parameter oftelegram.Bot.post_story().- Type:
int
- ACTIVITY_TWO_DAYS = 172800[source]¶
Possible value for
active_period`parameter oftelegram.Bot.post_story().- Type:
int
- CAPTION_LENGTH = 2048[source]¶
Maximum number of characters in
telegram.Bot.post_story.captionparameter oftelegram.Bot.post_story()andtelegram.Bot.edit_story.captionoftelegram.Bot.edit_story().- Type:
int
- class telegram.constants.SuggestedPost(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.SuggestedPostPrice/telegram.SuggestedPostParameters/telegram.Bot.decline_suggested_post(). The enum members of this enumeration are instances ofintand can be treated as such.Added in version 22.4.
- MAX_COMMENT_LENGTH = 128[source]¶
Maximum number of characters in the
telegram.Bot.decline_suggested_post.commentparameter.- Type:
int
- MAX_PRICE_NANOTONCOINS = 10000000000000[source]¶
Maximum number of nanotoncoins in
amountparameter oftelegram.SuggestedPostPrice.- Type:
int
- MAX_PRICE_STARS = 100000[source]¶
Maximum number of Telegram Stars in
amountparameter oftelegram.SuggestedPostPrice.- Type:
int
- MAX_SEND_DATE = 2678400[source]¶
Maximum number of seconds in the future for the
send_dateparameter oftelegram.SuggestedPostParameters.- Type:
int
- MIN_PRICE_NANOTONCOINS = 10000000[source]¶
Minimum number of nanotoncoins in
amountparameter oftelegram.SuggestedPostPrice.- Type:
int
- MIN_PRICE_STARS = 5[source]¶
Minimum number of Telegram Stars in
amountparameter oftelegram.SuggestedPostPrice.- Type:
int
- MIN_SEND_DATE = 300[source]¶
Minimum number of seconds in the future for the
send_dateparameter oftelegram.SuggestedPostParameters.- Type:
int
- class telegram.constants.SuggestedPostInfoState(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available states of
telegram.SuggestedPostInfo.state. The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 22.4.
- class telegram.constants.SuggestedPostRefunded(*values)[source]¶
Bases:
str,enum.EnumThis enum contains available refund reasons for
telegram.SuggestedPostRefunded. The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 22.4.
- class telegram.constants.TagLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
set_chat_member_tag(). The enum members of this enumeration are instances ofintand can be treated as such.Added in version 22.7.
- class telegram.constants.TransactionPartnerType(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available types of
telegram.TransactionPartner. The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 21.4.
- AFFILIATE_PROGRAM = 'affiliate_program'[source]¶
Transaction with Affiliate Program.
Added in version 21.9.
- Type:
str
- TELEGRAM_API = 'telegram_api'[source]¶
Transaction with with payment for paid broadcasting.
Added in version 21.7.
- Type:
str
- class telegram.constants.TransactionPartnerUser(*values)[source]¶
Bases:
str,enum.EnumThis enum contains constants for
telegram.TransactionPartnerUser. The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 22.1.
- BUSINESS_ACCOUNT_TRANSFER = 'business_account_transfer'[source]¶
Possible value for
telegram.TransactionPartnerUser.transaction_type.- Type:
str
- GIFT_PURCHASE = 'gift_purchase'[source]¶
Possible value for
telegram.TransactionPartnerUser.transaction_type.- Type:
str
- INVOICE_PAYMENT = 'invoice_payment'[source]¶
Possible value for
telegram.TransactionPartnerUser.transaction_type.- Type:
str
- PAID_MEDIA_PAYMENT = 'paid_media_payment'[source]¶
Possible value for
telegram.TransactionPartnerUser.transaction_type.- Type:
str
- PREMIUM_PURCHASE = 'premium_purchase'[source]¶
Possible value for
telegram.TransactionPartnerUser.transaction_type.- Type:
str
- class telegram.constants.UniqueGiftInfoOrigin(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available origins for
telegram.UniqueGiftInfo. The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 22.1.
- GIFTED_UPGRADE = 'gifted_upgrade'[source]¶
strupgrades purchased after the gift was sentAdded in version 22.6.
- class telegram.constants.UniqueGiftModelRarity(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available rarities for
telegram.UniqueGiftModel. The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 22.7.
- class telegram.constants.UpdateType(*values)[source]¶
Bases:
str,enum.EnumThis enum contains the available types of
telegram.Update. The enum members of this enumeration are instances ofstrand can be treated as such.Added in version 20.0.
- BUSINESS_CONNECTION = 'business_connection'[source]¶
Updates with
telegram.Update.business_connection.Added in version 21.1.
- Type:
str
- BUSINESS_MESSAGE = 'business_message'[source]¶
Updates with
telegram.Update.business_message.Added in version 21.1.
- Type:
str
- CALLBACK_QUERY = 'callback_query'[source]¶
Updates with
telegram.Update.callback_query.- Type:
str
- CHANNEL_POST = 'channel_post'[source]¶
Updates with
telegram.Update.channel_post.- Type:
str
- CHAT_BOOST = 'chat_boost'[source]¶
Updates with
telegram.Update.chat_boost.Added in version 20.8.
- Type:
str
- CHAT_JOIN_REQUEST = 'chat_join_request'[source]¶
Updates with
telegram.Update.chat_join_request.- Type:
str
- CHAT_MEMBER = 'chat_member'[source]¶
Updates with
telegram.Update.chat_member.- Type:
str
- CHOSEN_INLINE_RESULT = 'chosen_inline_result'[source]¶
Updates with
telegram.Update.chosen_inline_result.- Type:
str
- DELETED_BUSINESS_MESSAGES = 'deleted_business_messages'[source]¶
Updates with
telegram.Update.deleted_business_messages.Added in version 21.1.
- Type:
str
- EDITED_BUSINESS_MESSAGE = 'edited_business_message'[source]¶
Updates with
telegram.Update.edited_business_message.Added in version 21.1.
- Type:
str
- EDITED_CHANNEL_POST = 'edited_channel_post'[source]¶
Updates with
telegram.Update.edited_channel_post.- Type:
str
- EDITED_MESSAGE = 'edited_message'[source]¶
Updates with
telegram.Update.edited_message.- Type:
str
- INLINE_QUERY = 'inline_query'[source]¶
Updates with
telegram.Update.inline_query.- Type:
str
- MESSAGE = 'message'[source]¶
Updates with
telegram.Update.message.- Type:
str
- MESSAGE_REACTION = 'message_reaction'[source]¶
Updates with
telegram.Update.message_reaction.Added in version 20.8.
- Type:
str
- MESSAGE_REACTION_COUNT = 'message_reaction_count'[source]¶
Updates with
telegram.Update.message_reaction_count.Added in version 20.8.
- Type:
str
- MY_CHAT_MEMBER = 'my_chat_member'[source]¶
Updates with
telegram.Update.my_chat_member.- Type:
str
- POLL = 'poll'[source]¶
Updates with
telegram.Update.poll.- Type:
str
- POLL_ANSWER = 'poll_answer'[source]¶
Updates with
telegram.Update.poll_answer.- Type:
str
- PRE_CHECKOUT_QUERY = 'pre_checkout_query'[source]¶
Updates with
telegram.Update.pre_checkout_query.- Type:
str
- PURCHASED_PAID_MEDIA = 'purchased_paid_media'[source]¶
Updates with
telegram.Update.purchased_paid_media.Added in version 21.6.
- Type:
str
- REMOVED_CHAT_BOOST = 'removed_chat_boost'[source]¶
Updates with
telegram.Update.removed_chat_boost.Added in version 20.8.
- Type:
str
- SHIPPING_QUERY = 'shipping_query'[source]¶
Updates with
telegram.Update.shipping_query.- Type:
str
- class telegram.constants.UserProfileAudiosLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.Bot.get_user_profile_audios.limit. The enum members of this enumeration are instances ofintand can be treated as such.Added in version 22.7.
- MAX_LIMIT = 100[source]¶
Maximum value allowed for
limitparameter oftelegram.Bot.get_user_profile_audios().- Type:
int
- MIN_LIMIT = 1[source]¶
Minimum value allowed for
limitparameter oftelegram.Bot.get_user_profile_audios().- Type:
int
- class telegram.constants.UserProfilePhotosLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.Bot.get_user_profile_photos.limit. The enum members of this enumeration are instances ofintand can be treated as such.Added in version 20.0.
- MAX_LIMIT = 100[source]¶
Maximum value allowed for
limitparameter oftelegram.Bot.get_user_profile_photos().- Type:
int
- MIN_LIMIT = 1[source]¶
Minimum value allowed for
limitparameter oftelegram.Bot.get_user_profile_photos().- Type:
int
- class telegram.constants.VerifyLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
verify_chat()andverify_user(). The enum members of this enumeration are instances ofintand can be treated as such.Added in version 21.10.
- MAX_TEXT_LENGTH = 70[source]¶
Maximum number of characters in a
strpassed as thecustom_descriptionorcustom_descriptionparameter.- Type:
int
- class telegram.constants.WebhookLimit(*values)[source]¶
Bases:
enum.IntEnumThis enum contains limitations for
telegram.Bot.set_webhook.max_connectionsandtelegram.Bot.set_webhook.secret_token. The enum members of this enumeration are instances ofintand can be treated as such.Added in version 20.0.
- MAX_CONNECTIONS_LIMIT = 100[source]¶
Maximum value allowed for the
max_connectionsparameter oftelegram.Bot.set_webhook().- Type:
int
- MAX_SECRET_TOKEN_LENGTH = 256[source]¶
Maximum length of the secret token for the
secret_tokenparameter oftelegram.Bot.set_webhook().- Type:
int
- MIN_CONNECTIONS_LIMIT = 1[source]¶
Minimum value allowed for the
max_connectionsparameter oftelegram.Bot.set_webhook().- Type:
int
- MIN_SECRET_TOKEN_LENGTH = 1[source]¶
Minimum length of the secret token for the
secret_tokenparameter oftelegram.Bot.set_webhook().- Type:
int