telegram.constants Module
Constants in the Telegram network.
The following constants were extracted from the Telegram Bots FAQ and Telegram Bots API.
- telegram.constants.BOT_API_VERSION
6.0. Telegram Bot API version supported by this version of python-telegram-bot. Also available as
telegram.bot_api_version
.New in version 13.4.
- Type
str
- telegram.constants.MAX_MESSAGE_LENGTH
4096
- Type
int
- telegram.constants.MAX_CAPTION_LENGTH
1024
- Type
int
- telegram.constants.SUPPORTED_WEBHOOK_PORTS
[443, 80, 88, 8443]
- Type
List[
int
]
- telegram.constants.MAX_FILESIZE_DOWNLOAD
In bytes (20MB)
- Type
int
- telegram.constants.MAX_FILESIZE_UPLOAD
In bytes (50MB)
- Type
int
- telegram.constants.MAX_PHOTOSIZE_UPLOAD
In bytes (10MB)
- Type
int
- telegram.constants.MAX_MESSAGES_PER_SECOND_PER_CHAT
1. Telegram may allow short bursts that go over this limit, but eventually you’ll begin receiving 429 errors.
- Type
int
- telegram.constants.MAX_MESSAGES_PER_SECOND
30
- Type
int
- telegram.constants.MAX_MESSAGES_PER_MINUTE_PER_GROUP
20
- Type
int
- telegram.constants.MAX_INLINE_QUERY_RESULTS
50
- Type
int
- telegram.constants.MAX_ANSWER_CALLBACK_QUERY_TEXT_LENGTH
200
New in version 13.2.
- Type
int
The following constant have been found by experimentation:
- telegram.constants.MAX_MESSAGE_ENTITIES
100 (Beyond this cap telegram will simply ignore further formatting styles)
- Type
int
- telegram.constants.ANONYMOUS_ADMIN_ID
1087968824
(User id in groups for anonymous admin)- Type
int
- telegram.constants.SERVICE_CHAT_ID
777000
(Telegram service chat, that also acts as sender of channel posts forwarded to discussion groups)- Type
int
- telegram.constants.FAKE_CHANNEL_ID
136817688
(User id in groups when message is sent on behalf of a channel).New in version 13.9.
- Type
int
The following constants are related to specific classes and are also available as attributes of those classes:
- telegram.constants.CHAT_PRIVATE
'private'
- Type
str
- telegram.constants.CHAT_GROUP
'group'
- Type
str
- telegram.constants.CHAT_SUPERGROUP
'supergroup'
- Type
str
- telegram.constants.CHAT_CHANNEL
'channel'
- Type
str
- telegram.constants.CHAT_SENDER
'sender'
. Only relevant fortelegram.InlineQuery.chat_type
.New in version 13.5.
- Type
str
- telegram.constants.CHATACTION_FIND_LOCATION
'find_location'
- Type
str
- telegram.constants.CHATACTION_RECORD_AUDIO
'record_audio'
Deprecated since version 13.5: Deprecated by Telegram. Use
CHATACTION_RECORD_VOICE
instead.- Type
str
- telegram.constants.CHATACTION_RECORD_VOICE
'record_voice'
New in version 13.5.
- Type
str
- telegram.constants.CHATACTION_RECORD_VIDEO
'record_video'
- Type
str
- telegram.constants.CHATACTION_RECORD_VIDEO_NOTE
'record_video_note'
- Type
str
- telegram.constants.CHATACTION_TYPING
'typing'
- Type
str
- telegram.constants.CHATACTION_UPLOAD_AUDIO
'upload_audio'
Deprecated since version 13.5: Deprecated by Telegram. Use
CHATACTION_UPLOAD_VOICE
instead.- Type
str
- telegram.constants.CHATACTION_UPLOAD_VOICE
'upload_voice'
New in version 13.5.
- Type
str
- telegram.constants.CHATACTION_UPLOAD_DOCUMENT
'upload_document'
- Type
str
- telegram.constants.CHATACTION_CHOOSE_STICKER
'choose_sticker'
New in version 13.8.
- Type
str
- telegram.constants.CHATACTION_UPLOAD_PHOTO
'upload_photo'
- Type
str
- telegram.constants.CHATACTION_UPLOAD_VIDEO
'upload_video'
- Type
str
- telegram.constants.CHATACTION_UPLOAD_VIDEO_NOTE
'upload_video_note'
- Type
str
- telegram.constants.CHATMEMBER_ADMINISTRATOR
'administrator'
- Type
str
- telegram.constants.CHATMEMBER_CREATOR
'creator'
- Type
str
- telegram.constants.CHATMEMBER_KICKED
'kicked'
- Type
str
- telegram.constants.CHATMEMBER_LEFT
'left'
- Type
str
- telegram.constants.CHATMEMBER_MEMBER
'member'
- Type
str
- telegram.constants.CHATMEMBER_RESTRICTED
'restricted'
- Type
str
- telegram.constants.DICE_DICE
'🎲'
- Type
str
- telegram.constants.DICE_DARTS
'🎯'
- Type
str
- telegram.constants.DICE_BASKETBALL
'🏀'
- Type
str
- telegram.constants.DICE_FOOTBALL
'⚽'
- Type
str
- telegram.constants.DICE_SLOT_MACHINE
'🎰'
- Type
str
- telegram.constants.DICE_BOWLING
'🎳'
New in version 13.4.
- Type
str
- telegram.constants.DICE_ALL_EMOJI
List of all supported base emoji.
Changed in version 13.4: Added
DICE_BOWLING
- Type
List[
str
]
- telegram.constants.MESSAGEENTITY_MENTION
'mention'
- Type
str
- telegram.constants.MESSAGEENTITY_HASHTAG
'hashtag'
- Type
str
- telegram.constants.MESSAGEENTITY_CASHTAG
'cashtag'
- Type
str
- telegram.constants.MESSAGEENTITY_PHONE_NUMBER
'phone_number'
- Type
str
- telegram.constants.MESSAGEENTITY_BOT_COMMAND
'bot_command'
- Type
str
- telegram.constants.MESSAGEENTITY_URL
'url'
- Type
str
- telegram.constants.MESSAGEENTITY_EMAIL
'email'
- Type
str
- telegram.constants.MESSAGEENTITY_BOLD
'bold'
- Type
str
- telegram.constants.MESSAGEENTITY_ITALIC
'italic'
- Type
str
- telegram.constants.MESSAGEENTITY_CODE
'code'
- Type
str
- telegram.constants.MESSAGEENTITY_PRE
'pre'
- Type
str
- telegram.constants.MESSAGEENTITY_TEXT_LINK
'text_link'
- Type
str
- telegram.constants.MESSAGEENTITY_TEXT_MENTION
'text_mention'
- Type
str
- telegram.constants.MESSAGEENTITY_UNDERLINE
'underline'
- Type
str
- telegram.constants.MESSAGEENTITY_STRIKETHROUGH
'strikethrough'
- Type
str
- telegram.constants.MESSAGEENTITY_SPOILER
'spoiler'
New in version 13.10.
- Type
str
- telegram.constants.MESSAGEENTITY_ALL_TYPES
List of all the types of message entity.
- Type
List[
str
]
- telegram.constants.PARSEMODE_MARKDOWN
'Markdown'
- Type
str
- telegram.constants.PARSEMODE_MARKDOWN_V2
'MarkdownV2'
- Type
str
- telegram.constants.PARSEMODE_HTML
'HTML'
- Type
str
- telegram.constants.POLL_REGULAR
'regular'
- Type
str
- telegram.constants.POLL_QUIZ
'quiz'
- Type
str
- telegram.constants.MAX_POLL_QUESTION_LENGTH
300
- Type
int
- telegram.constants.MAX_POLL_OPTION_LENGTH
100
- Type
int
- telegram.constants.STICKER_FOREHEAD
'forehead'
- Type
str
- telegram.constants.STICKER_EYES
'eyes'
- Type
str
- telegram.constants.STICKER_MOUTH
'mouth'
- Type
str
- telegram.constants.STICKER_CHIN
'chin'
- Type
str
- telegram.constants.UPDATE_MESSAGE
'message'
New in version 13.5.
- Type
str
- telegram.constants.UPDATE_EDITED_MESSAGE
'edited_message'
New in version 13.5.
- Type
str
- telegram.constants.UPDATE_CHANNEL_POST
'channel_post'
New in version 13.5.
- Type
str
- telegram.constants.UPDATE_EDITED_CHANNEL_POST
'edited_channel_post'
New in version 13.5.
- Type
str
- telegram.constants.UPDATE_INLINE_QUERY
'inline_query'
New in version 13.5.
- Type
str
- telegram.constants.UPDATE_CHOSEN_INLINE_RESULT
'chosen_inline_result'
New in version 13.5.
- Type
str
- telegram.constants.UPDATE_CALLBACK_QUERY
'callback_query'
New in version 13.5.
- Type
str
- telegram.constants.UPDATE_SHIPPING_QUERY
'shipping_query'
New in version 13.5.
- Type
str
- telegram.constants.UPDATE_PRE_CHECKOUT_QUERY
'pre_checkout_query'
New in version 13.5.
- Type
str
- telegram.constants.UPDATE_POLL
'poll'
New in version 13.5.
- Type
str
- telegram.constants.UPDATE_POLL_ANSWER
'poll_answer'
New in version 13.5.
- Type
str
- telegram.constants.UPDATE_MY_CHAT_MEMBER
'my_chat_member'
New in version 13.5.
- Type
str
- telegram.constants.UPDATE_CHAT_MEMBER
'chat_member'
New in version 13.5.
- Type
str
- telegram.constants.UPDATE_CHAT_JOIN_REQUEST
'chat_join_request'
New in version 13.8.
- Type
str
- telegram.constants.UPDATE_ALL_TYPES
List of all update types.
New in version 13.5.
Changed in version 13.8.
- Type
List[
str
]
- telegram.constants.BOT_COMMAND_SCOPE_DEFAULT
'default'
..versionadded:: 13.7
- Type
str
- telegram.constants.BOT_COMMAND_SCOPE_ALL_PRIVATE_CHATS
'all_private_chats'
..versionadded:: 13.7
- Type
str
- telegram.constants.BOT_COMMAND_SCOPE_ALL_GROUP_CHATS
'all_group_chats'
..versionadded:: 13.7
- Type
str
- telegram.constants.BOT_COMMAND_SCOPE_ALL_CHAT_ADMINISTRATORS
'all_chat_administrators'
..versionadded:: 13.7
- Type
str
- telegram.constants.BOT_COMMAND_SCOPE_CHAT
'chat'
..versionadded:: 13.7
- Type
str
- telegram.constants.BOT_COMMAND_SCOPE_CHAT_ADMINISTRATORS
'chat_administrators'
..versionadded:: 13.7
- Type
str
- telegram.constants.BOT_COMMAND_SCOPE_CHAT_MEMBER
'chat_member'
..versionadded:: 13.7
- Type
str