telegram library

Telegram Library. It groups all the Telegram Api objects. All objects used in the Bot API responses are represented as JSON-objects. It is safe to use 32-bit signed integers for storing all Integer fields unless otherwise noted. Optional fields may be not returned when irrelevant.

Classes

Animation
This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound).
Audio
This object represents an audio file to be treated as music by the Telegram clients.
BotCommand
This object represents a bot command.
CallbackGame
A placeholder, currently holds no information. Use BotFather to set up your game.
CallbackQuery
This object represents an incoming callback query from a callback button in an inline keyboard. If the button that originated the query was attached to a message sent by the bot, the field message will be present. If the button was attached to a message sent via the bot (in inline mode), the field inline_message_id will be present. Exactly one of the fields data or game_short_name will be present.
Chat
This object represents a chat.
ChatMember
This object contains information about one member of a chat.
ChatPermissions
Describes actions that a non-administrator user is allowed to take in a chat.
ChatPhoto
This object represents a chat photo.
ChosenInlineResult
Represents a result of an inline query that was chosen by the user and sent to their chat partner.
Contact
This object represents a phone contact.
Dice
This object represents a dice with random value from 1 to 6. (Yes, we're aware of the “proper” singular of die. But it's awkward, and we decided to help it change. One dice at a time!)
Document
This object represents a general file (as opposed to photos, voice messages and audio files).
EncryptedCredentials
Contains data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes.
EncryptedPassportElement
Contains information about documents or other Telegram Passport elements shared with the bot by the user.
File
This object represents a file ready to be downloaded. The file can be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile.
ForceReply
Upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot‘s message and tapped ’Reply'). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode.
Game
This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers.
GameHighScore
This object represents one row of the high scores table for a game.
InlineKeyboardButton
This object represents one button of an inline keyboard. You must use exactly one of the optional fields.
InlineKeyboardMarkup
This object represents an inline keyboard that appears right next to the message it belongs to.
InlineQuery
This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results.
InlineQueryResult
This object represents one result of an inline query. Telegram clients currently support results of the following 20 types:
InlineQueryResultArticle
Represents a link to an article or web page.
InlineQueryResultAudio
Represents a link to an mp3 audio file. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.
InlineQueryResultCachedAudio
Represents a link to an mp3 audio file stored on the Telegram servers. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.
InlineQueryResultCachedDocument
Represents a link to a file stored on the Telegram servers. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file.
InlineQueryResultCachedGif
Represents a link to an animated GIF file stored on the Telegram servers. By default, this animated GIF file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with specified content instead of the animation.
InlineQueryResultCachedMpeg4Gif
Represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the Telegram servers. By default, this animated MPEG-4 file will be sent by the user with an optional caption.
InlineQueryResultCachedPhoto
Represents a link to a photo stored on the Telegram servers. By default, this photo will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo.
InlineQueryResultCachedSticker
Represents a link to a sticker stored on the Telegram servers. By default, this sticker will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the sticker.
InlineQueryResultCachedVideo
Represents a link to a video file stored on the Telegram servers. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video.
InlineQueryResultCachedVoice
Represents a link to a voice message stored on the Telegram servers. By default, this voice message will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the voice message.
InlineQueryResultContact
Represents a contact with a phone number. By default, the contact will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the contact.
InlineQueryResultDocument
Represents a link to a file. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. Currently, only .PDF and .ZIP files can be sent using this method.
InlineQueryResultGame
Represents a Game.
InlineQueryResultGif
Represents a link to an animated GIF file. By default, this animated GIF file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
InlineQueryResultLocation
Represents a location on a map. By default, the location will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the location.
InlineQueryResultMpeg4Gif
Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default, this animated MPEG-4 file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
InlineQueryResultPhoto
Represents a link to a photo. By default, this photo will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo.
InlineQueryResultVenue
Represents a venue. By default, the venue will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the venue.
InlineQueryResultVideo
Represents a link to a page containing an embedded video player or a video file. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video.
InlineQueryResultVoice
Represents a link to a voice recording in an .ogg container encoded with OPUS. By default, this voice recording will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the the voice message.
InputContactMessageContent
Represents the content of a contact message to be sent as the result of an inline query.
InputLocationMessageContent
Represents the content of a location message to be sent as the result of an inline query.
InputMedia
This object represents the content of a media message to be sent. It should be one of
InputMediaAnimation
Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent.
InputMediaAudio
Represents an audio file to be treated as music to be sent.
InputMediaDocument
Represents a general file to be sent.
InputMediaPhoto
Represents a photo to be sent.
InputMediaVideo
Represents a video to be sent.
InputMessageContent
This object represents the content of a message to be sent as a result of an inline query. Telegram clients currently support the following 4 types:
InputTextMessageContent
Represents the content of a text message to be sent as the result of an inline query.
InputVenueMessageContent
Represents the content of a venue message to be sent as the result of an inline query.
Invoice
This object contains basic information about an invoice.
KeyboardButton
This object represents one button of the reply keyboard. For simple text buttons String can be used instead of this object to specify text of the button. Optional fields are mutually exclusive.
KeyboardButtonPollType
This object represents type of a poll, which is allowed to be created and sent when the corresponding button is pressed.
LabeledPrice
This object represents a portion of the price for goods or services.
LinkPreviewOptions
Describes the options used for link preview generation.
Location
This object represents a point on the map.
LoginUrl
This object represents a parameter of the inline keyboard button used to automatically authorize a user. Serves as a great replacement for the Telegram Login Widget when the user is coming from Telegram. All the user needs to do is tap/click a button and confirm that they want to log in.
MaskPosition
This object describes the position on faces where a mask should be placed by default.
Message
This object represents a message.
MessageEntity
This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc.
MessageId
This object represents a unique message identifier.
OrderInfo
This object represents information about an order.
PassportData
Contains information about Telegram Passport data shared with the bot by the user.
PassportElementError
This object represents an error in the Telegram Passport element which was submitted that should be resolved by the user. It should be one of:
PassportElementErrorDataField
Represents an issue in one of the data fields that was provided by the user. The error is considered resolved when the field's value changes.
PassportElementErrorFile
Represents an issue with a document scan. The error is considered resolved when the file with the document scan changes.
PassportElementErrorFiles
Represents an issue with a list of scans. The error is considered resolved when the list of files containing the scans changes.
PassportElementErrorFrontSide
Represents an issue with the front side of a document. The error is considered resolved when the file with the front side of the document changes.
PassportElementErrorReverseSide
Represents an issue with the reverse side of a document. The error is considered resolved when the file with reverse side of the document changes.
PassportElementErrorSelfie
Represents an issue with the selfie with a document. The error is considered resolved when the file with the selfie changes.
PassportElementErrorTranslationFile
Represents an issue with one of the files that constitute the translation of a document. The error is considered resolved when the file changes.
PassportElementErrorTranslationFiles
Represents an issue with the translated version of a document. The error is considered resolved when a file with the document translation change.
PassportElementErrorUnspecified
Represents an issue in an unspecified place. The error is considered resolved when new data is added.
PassportFile
This object represents a file uploaded to Telegram Passport. Currently all Telegram Passport files are in JPEG format when decrypted and don't exceed 10MB.
PhotoSize
This object represents one size of a photo or a file / sticker thumbnail.
Poll
This object contains information about a poll.
PollAnswer
This object represents an answer of a user in a non-anonymous poll.
PollOption
This object contains information about one answer option in a poll.
PreCheckoutQuery
This object contains information about an incoming pre-checkout query.
ReplyKeyboardMarkup
This object represents a custom keyboard with reply options (see Introduction to bots for details and examples).
ReplyKeyboardRemove
Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display the default letter-keyboard. By default, custom keyboards are displayed until a new keyboard is sent by a bot. An exception is made for one-time keyboards that are hidden immediately after the user presses a button (see ReplyKeyboardMarkup).
ReplyMarkup
Abstract object that represents a ReplyMarkup.
ReplyParameters
Describes reply parameters for the message that is being sent.
ResponseParameters
Contains information about why a request was unsuccessful.
ShippingAddress
This object represents a shipping address.
ShippingOption
This object represents one shipping option.
ShippingQuery
This object contains information about an incoming shipping query.
Sticker
This object represents a sticker.
StickerSet
This object represents a sticker set.
SuccessfulPayment
This object contains basic information about a successful payment.
TextQuote
Contains the quoted part of a message that is replied to.
Update
This object represents an incoming update. At most one of the optional parameters can be present in any given update.
User
This object represents a Telegram user or bot.
UserProfilePhotos
This object represent a user's profile pictures.
Venue
This object represents a venue.
Video
This object represents a venue.
VideoNote
This object represents a video message (available in Telegram apps as of v.4.0).
Voice
This object represents a voice note.
WebhookInfo
Contains information about the current status of a webhook.