telegram.constants Module¶
Constants in the Telegram network.
The following constants were extracted from the Telegram Bots FAQ and Telegram Bots API.
-
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
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.CHATACTION_FIND_LOCATION¶ ‘find_location’
- Type
str
-
telegram.constants.CHATACTION_RECORD_AUDIO¶ ‘record_audio’
- 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’
- Type
str
-
telegram.constants.CHATACTION_UPLOAD_DOCUMENT¶ ‘upload_document’
- 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_ALL_EMOJI¶ List of all supported base emoji.
- 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_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.files.MaskPosition:
-
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