Hide navigation sidebar
Hide table of contents sidebar
PTB has undergone significant changes in v20. Please read the documentation carefully and also check out the transition guide in the wiki.
Back to top
Toggle table of contents sidebar

# telegram package

## Version Constants

A library that provides a Python interface to the Telegram Bot API

telegram.__bot_api_version__ = '7.0'

  Shortcut for `telegram.constants.BOT_API_VERSION`.

  Changed in version 20.0: This constant was previously named `bot_api_version`.

  Type:

    `str`

telegram.__bot_api_version_info__ = (7, 0)

  Shortcut for `telegram.constants.BOT_API_VERSION_INFO`.

  New in version 20.0.

  Type:

    `typing.NamedTuple`

telegram.__version__ = '20.8'

  The version of the python-telegram-bot library as string. To get detailed information about the version number, please use `__version_info__` instead.

  Type:

    `str`

telegram.__version_info__ = (20, 8, 0, 'final', 0)

  A tuple containing the five components of the version number: major, minor, micro, releaselevel, and serial. All values except releaselevel are integers. The release level is `'alpha'`, `'beta'`, `'candidate'`, or `'final'`. The components can also be accessed by name, so `__version_info__[0]` is equivalent to `__version_info__.major` and so on.

  New in version 20.0.

  Type:

    `typing.NamedTuple`

## Classes in this package

- Bot
- Available Types
  - Animation
  - Audio
  - BotCommand
  - BotCommandScope
  - BotCommandScopeAllChatAdministrators
  - BotCommandScopeAllGroupChats
  - BotCommandScopeAllPrivateChats
  - BotCommandScopeChat
  - BotCommandScopeChatAdministrators
  - BotCommandScopeChatMember
  - BotCommandScopeDefault
  - BotDescription
  - BotName
  - BotShortDescription
  - CallbackQuery
  - Chat
  - ChatAdministratorRights
  - ChatBoost
  - ChatBoostRemoved
  - ChatBoostSource
  - ChatBoostSourceGiftCode
  - ChatBoostSourceGiveaway
  - ChatBoostSourcePremium
  - ChatBoostUpdated
  - ChatInviteLink
  - ChatJoinRequest
  - ChatLocation
  - ChatMember
  - ChatMemberAdministrator
  - ChatMemberBanned
  - ChatMemberLeft
  - ChatMemberMember
  - ChatMemberOwner
  - ChatMemberRestricted
  - ChatMemberUpdated
  - ChatPermissions
  - ChatPhoto
  - ChatShared
  - Contact
  - Dice
  - Document
  - ExternalReplyInfo
  - File
  - ForceReply
  - ForumTopic
  - ForumTopicClosed
  - ForumTopicCreated
  - ForumTopicEdited
  - ForumTopicReopened
  - GeneralForumTopicHidden
  - GeneralForumTopicUnhidden
  - Giveaway
  - GiveawayCompleted
  - GiveawayCreated
  - GiveawayWinners
  - InaccessibleMessage
  - InlineKeyboardButton
  - InlineKeyboardMarkup
  - InputFile
  - InputMedia
  - InputMediaAnimation
  - InputMediaAudio
  - InputMediaDocument
  - InputMediaPhoto
  - InputMediaVideo
  - InputSticker
  - KeyboardButton
  - KeyboardButtonPollType
  - KeyboardButtonRequestChat
  - KeyboardButtonRequestUser
  - KeyboardButtonRequestUsers
  - LinkPreviewOptions
  - Location
  - LoginUrl
  - MaybeInaccessibleMessage
  - MenuButton
  - MenuButtonCommands
  - MenuButtonDefault
  - MenuButtonWebApp
  - Message
  - MessageAutoDeleteTimerChanged
  - MessageEntity
  - MessageId
  - MessageOrigin
  - MessageOriginChannel
  - MessageOriginChat
  - MessageOriginHiddenUser
  - MessageOriginUser
  - MessageReactionCountUpdated
  - MessageReactionUpdated
  - PhotoSize
  - Poll
  - PollAnswer
  - PollOption
  - ProximityAlertTriggered
  - ReactionCount
  - ReactionType
  - ReactionTypeCustomEmoji
  - ReactionTypeEmoji
  - ReplyKeyboardMarkup
  - ReplyKeyboardRemove
  - ReplyParameters
  - SentWebAppMessage
  - Story
  - SwitchInlineQueryChosenChat
  - TelegramObject
  - TextQuote
  - Update
  - User
  - UserChatBoosts
  - UserProfilePhotos
  - UserShared
  - UsersShared
  - Venue
  - Video
  - VideoChatEnded
  - VideoChatParticipantsInvited
  - VideoChatScheduled
  - VideoChatStarted
  - VideoNote
  - Voice
  - WebAppData
  - WebAppInfo
  - WebhookInfo
  - WriteAccessAllowed
- Stickers
  - MaskPosition
  - Sticker
  - StickerSet
- Inline Mode
  - ChosenInlineResult
  - InlineQuery
  - InlineQueryResult
  - InlineQueryResultArticle
  - InlineQueryResultAudio
  - InlineQueryResultCachedAudio
  - InlineQueryResultCachedDocument
  - InlineQueryResultCachedGif
  - InlineQueryResultCachedMpeg4Gif
  - InlineQueryResultCachedPhoto
  - InlineQueryResultCachedSticker
  - InlineQueryResultCachedVideo
  - InlineQueryResultCachedVoice
  - InlineQueryResultContact
  - InlineQueryResultDocument
  - InlineQueryResultGame
  - InlineQueryResultGif
  - InlineQueryResultLocation
  - InlineQueryResultMpeg4Gif
  - InlineQueryResultPhoto
  - InlineQueryResultsButton
  - InlineQueryResultVenue
  - InlineQueryResultVideo
  - InlineQueryResultVoice
  - InputMessageContent
  - InputTextMessageContent
  - InputLocationMessageContent
  - InputVenueMessageContent
  - InputContactMessageContent
  - InputInvoiceMessageContent
- Payments
  - Invoice
  - LabeledPrice
  - OrderInfo
  - PreCheckoutQuery
  - ShippingAddress
  - ShippingOption
  - ShippingQuery
  - SuccessfulPayment
- Games
  - Callbackgame
  - Game
  - GameHighScore
- Passport
  - Credentials
  - DataCredentials
  - EncryptedCredentials
  - EncryptedPassportElement
  - FileCredentials
  - IdDocumentData
  - PassportData
  - PassportElementError
  - PassportElementErrorDataField
  - PassportElementErrorFile
  - PassportElementErrorFiles
  - PassportElementErrorFrontSide
  - PassportElementErrorReverseSide
  - PassportElementErrorSelfie
  - PassportElementErrorTranslationFile
  - PassportElementErrorTranslationFiles
  - PassportElementErrorUnspecified
  - PassportFile
  - PersonalDetails
  - ResidentialAddress
  - SecureData
  - SecureValue