python-telegram-bot API reference
173 public APIs from python-telegram-bot (python-telegram-bot/python-telegram-bot) — 133 classes, 8 functions, 32 methods. Signatures extracted by static analysis of the actual source.
Repository: python-telegram-bot/python-telegram-bot
| Kind | Count |
|---|---|
| Classes | 133 |
| Functions | 8 |
| Methods | 32 |
API list
class
changes.config.ChangoSectionChangeNoteCustom change note type for PTB.
class
changes.config.CustomChangoCustom ChanGo class for overriding release
class
src.telegram._birthdate.BirthdateThis object describes the birthdate of a user.
method
src.telegram._birthdate.Birthdate.to_date(year:int | None=None) -> dtm.dateReturn the birthdate as a date object.
class
src.telegram._botcommand.BotCommandThis object represents a bot command.
class
src.telegram._botcommandscope.BotCommandScopeDefaultRepresents the default scope of bot commands.
class
src.telegram._botdescription.BotDescriptionThis object represents the bot's description.
class
src.telegram._botname.BotNameThis object represents the bot's name.
class
src.telegram._chat.ChatThis object represents a chat.
class
src.telegram._chatbackground.BackgroundFillBase class for Telegram BackgroundFill Objects.
class
src.telegram._chatbackground.BackgroundFillGradientThe background is a gradient fill.
class
src.telegram._chatbackground.BackgroundTypeBase class for Telegram BackgroundType Objects.
class
src.telegram._chatbackground.ChatBackgroundThis object represents a chat background.
class
src.telegram._chatboost.ChatBoostThis object contains information about a chat boost.
class
src.telegram._chatboost.ChatBoostSourceBase class for Telegram ChatBoostSource objects.
class
src.telegram._chatfullinfo.ChatFullInfoThis object contains full information about a chat.
class
src.telegram._chatinvitelink.ChatInviteLinkThis object represents an invite link for a chat.
class
src.telegram._chatmember.ChatMemberBase class for Telegram ChatMember Objects.
class
src.telegram._checklists.ChecklistDescribes a checklist.
class
src.telegram._checklists.ChecklistTaskDescribes a task in a checklist.
class
src.telegram._files.chatphoto.ChatPhotoThis object represents a chat photo.
class
src.telegram._files.contact.ContactThis object represents a phone contact.
class
src.telegram._files.file.FileThis object represents a file ready to be downloaded.
method
src.telegram._files.file.File.set_credentials(credentials:'FileCredentials') -> NoneSets the passport credentials for the file.
class
src.telegram._files.inputfile.InputFileThis object represents a Telegram InputFile.
class
src.telegram._files.inputmedia.InputMediaDocumentRepresents a general file to be sent.
class
src.telegram._files.inputmedia.InputMediaLivePhotoRepresents a live photo to be sent.
class
src.telegram._files.inputmedia.InputMediaLocationRepresents a location to be sent.
class
src.telegram._files.inputmedia.InputMediaPhotoRepresents a photo to be sent.
class
src.telegram._files.inputmedia.InputMediaStickerRepresents a sticker file to be sent.
class
src.telegram._files.inputmedia.InputMediaVenueRepresents a venue to be sent.
class
src.telegram._files.inputmedia.InputMediaVideoRepresents a video to be sent.
class
src.telegram._files.inputmedia.InputPaidMediaBase class for Telegram InputPaidMedia Objects.
class
src.telegram._files.inputmedia.InputPaidMediaLivePhotoThe paid media to send is a live photo.
class
src.telegram._files.inputmedia.InputPaidMediaPhotoThe paid media to send is a photo.
class
src.telegram._files.inputmedia.InputPaidMediaVideoThe paid media to send is a video.
class
src.telegram._files.inputprofilephoto.InputProfilePhotoThis object describes a profile photo to set.
class
src.telegram._files.inputprofilephoto.InputProfilePhotoStaticA static profile photo in the .JPG format.
class
src.telegram._files.inputstorycontent.InputStoryContentPhotoDescribes a photo to post as a story.
class
src.telegram._files.inputstorycontent.InputStoryContentVideoDescribes a video to post as a story.
class
src.telegram._files.livephoto.LivePhotoThis object represents a live photo.
class
src.telegram._files.location.LocationThis object represents a point on the map.
class
src.telegram._files.sticker.StickerThis object represents a sticker.
class
src.telegram._files.sticker.StickerSetThis object represents a sticker set.
class
src.telegram._files.venue.VenueThis object represents a venue.
class
src.telegram._files.video.VideoThis object represents a video file.
class
src.telegram._files.voice.VoiceThis object represents a voice note.
class
src.telegram._forumtopic.ForumTopicThis object represents a forum topic.
class
src.telegram._games.callbackgame.CallbackGameA placeholder, currently holds no information.
class
src.telegram._games.game.GameThis object represents a game.
class
src.telegram._gifts.GiftBackgroundThis object describes the background of a gift.
class
src.telegram._gifts.GiftsThis object represent a list of gifts.
class
src.telegram._inline.inlinequery.InlineQueryThis object represents an incoming inline query.
class
src.telegram._inline.inlinequeryresult.InlineQueryResultBaseclass for the InlineQueryResult* classes.
class
src.telegram._inline.inlinequeryresultaudio.InlineQueryResultAudioRepresents a link to an mp3 audio file.
class
src.telegram._inline.inlinequeryresultdocument.InlineQueryResultDocumentRepresents a link to a file.
class
src.telegram._inline.inlinequeryresultgame.InlineQueryResultGameRepresents a :class:`telegram.Game`.
class
src.telegram._inline.inlinequeryresultgif.InlineQueryResultGifRepresents a link to an animated GIF file.
class
src.telegram._inline.inlinequeryresultlocation.InlineQueryResultLocationRepresents a location on a map.
class
src.telegram._inline.inlinequeryresultphoto.InlineQueryResultPhotoRepresents a link to a photo.
class
src.telegram._inline.inlinequeryresultvenue.InlineQueryResultVenueRepresents a venue.
class
src.telegram._inputchecklist.InputChecklistDescribes a checklist to create.
class
src.telegram._inputchecklist.InputChecklistTaskDescribes a task to add to a checklist.
class
src.telegram._message.InaccessibleMessageThis object represents an inaccessible message.
class
src.telegram._message.MaybeInaccessibleMessageBase class for Telegram Message Objects.
method
src.telegram._message.MaybeInaccessibleMessage.de_json(data:JSONDict, bot:'Bot | None'=None) -> 'MaybeInaccessibleMessage'See :meth:`telegram.TelegramObject.de_json`.
method
src.telegram._message.MaybeInaccessibleMessage.is_accessible() -> boolConvenience attribute.
method
src.telegram._message.Message.id() -> int:obj:`int`: Shortcut for :attr:`message_id`.
method
src.telegram._message.Message.link() -> str | None:obj:`str`: Convenience property.
class
src.telegram._messageid.MessageIdThis object represents a unique message identifier.
class
src.telegram._messageorigin.MessageOriginUserThe message was originally sent by a known user.
class
src.telegram._paidmedia.PaidMediaDescribes the paid media added to a message.
class
src.telegram._paidmedia.PaidMediaInfoDescribes the paid media added to a message.
class
src.telegram._paidmedia.PaidMediaLivePhotoThe paid media is a live photo.
class
src.telegram._paidmedia.PaidMediaPhotoThe paid media is a photo.
class
src.telegram._paidmedia.PaidMediaPreviewThe paid media isn't available before the payment.
class
src.telegram._paidmedia.PaidMediaVideoThe paid media is a video.
class
src.telegram._passport.data.PersonalDetailsThis object represents personal details.
class
src.telegram._passport.data.ResidentialAddressThis object represents a residential address.
class
src.telegram._payment.orderinfo.OrderInfoThis object represents information about an order.
class
src.telegram._payment.shippingoption.ShippingOptionThis object represents one shipping option.
class
src.telegram._payment.stars.revenuewithdrawalstate.RevenueWithdrawalStatePendingThe withdrawal is in progress.
class
src.telegram._payment.stars.revenuewithdrawalstate.RevenueWithdrawalStateSucceededThe withdrawal succeeded.
class
src.telegram._payment.stars.staramount.StarAmountDescribes an amount of Telegram Stars.
class
src.telegram._payment.stars.startransactions.StarTransactionDescribes a Telegram Star transaction.
class
src.telegram._payment.stars.transactionpartner.TransactionPartnerChatDescribes a transaction with a chat.
class
src.telegram._payment.stars.transactionpartner.TransactionPartnerUserDescribes a transaction with a user.
class
src.telegram._poll.PollThis object contains information about a poll.
class
src.telegram._reaction.ReactionTypeBase class for Telegram ReactionType Objects.
class
src.telegram._reaction.ReactionTypeCustomEmojiRepresents a reaction with a custom emoji.
class
src.telegram._reaction.ReactionTypeEmojiRepresents a reaction with a normal emoji.
class
src.telegram._reaction.ReactionTypePaidThe reaction is paid.
class
src.telegram._sentguestmessage.SentGuestMessageDescribes an inline message sent by a guest bot.
class
src.telegram._story.StoryThis object represents a story.
class
src.telegram._storyarea.LocationAddressDescribes the physical address of a location.
class
src.telegram._storyarea.StoryAreaDescribes a clickable area on a story media.
class
src.telegram._storyarea.StoryAreaTypeDescribes the type of a clickable area on a story.
class
src.telegram._storyarea.StoryAreaTypeLocationDescribes a story area pointing to a location.
class
src.telegram._suggestedpost.SuggestedPostInfoContains information about a suggested post.
class
src.telegram._suggestedpost.SuggestedPostPriceDesribes the price of a suggested post.
class
src.telegram._telegramobject.TelegramObjectBase class for most Telegram objects.
method
src.telegram._telegramobject.TelegramObject.de_json(data:JSONDict, bot:'Bot | None'=None) -> Tele_coConverts JSON data to a Telegram object.
method
src.telegram._telegramobject.TelegramObject.set_bot(bot:'Bot | None') -> NoneSets the :class:`telegram.Bot` instance associated with this object.
method
src.telegram._telegramobject.TelegramObject.to_dict(recursive:bool=True) -> JSONDictGives representation of object as :obj:`dict`.
method
src.telegram._telegramobject.TelegramObject.to_json() -> strGives a JSON representation of object.
class
src.telegram._uniquegift.UniqueGiftModelThis object describes the model of a unique gift.
class
src.telegram._update.UpdateThis object represents an incoming update.
class
src.telegram._user.UserThis object represents a Telegram user or bot.
method
src.telegram._user.User.full_name() -> str:obj:`str`: Convenience property.
method
src.telegram._user.User.link() -> str | None:obj:`str`: Convenience property.
method
src.telegram._user.User.name() -> str:obj:`str`: Convenience property.
func
src.telegram._utils.datetime.extract_tzinfo_from_defaults(bot:'Bot | None') -> dtm.tzinfo | NoneExtracts the timezone info from the default values of the bot.
func
src.telegram._utils.de_json.unwrap_optional(annotation:object) -> objectReturn the sole non-None member of an optional union, if it has one.
func
src.telegram._utils.files.guess_file_name(obj:FileInput) -> str | NoneIf the input is a file handle, read name and return it.
func
src.telegram._utils.files.is_local_file(obj:FilePathInput | None) -> boolChecks if a given string is a file on local system.
func
src.telegram._utils.logging.get_logger(file_name:str, class_name:str | None=None) -> logging.LoggerReturns a logger with an appropriate name.
class
src.telegram._utils.strings.TextEncodingThis enum contains encoding schemes for text.
func
src.telegram._utils.strings.to_camel_case(snake_str:str) -> strConverts a snake_case string to camelCase.
class
src.telegram._webhookinfo.WebhookInfoThis object represents a Telegram WebhookInfo.
class
src.telegram.constants.ChatIDThis enum contains some special chat IDs.
class
src.telegram.constants.ParseModeThis enum contains the available parse modes.
class
src.telegram.error.EndPointNotFoundRaised when the requested endpoint is not found.
class
src.telegram.error.InvalidTokenRaised when the token is invalid.
class
src.telegram.error.NetworkErrorBase class for exceptions due to networking errors.
class
src.telegram.error.PassportDecryptionErrorSomething went wrong with decryption.
class
src.telegram.error.RetryAfterRaised when flood limits where exceeded.
class
src.telegram.error.TelegramErrorBase class for Telegram errors.
class
src.telegram.error.TimedOutRaised when a request took too long to finish.
method
src.telegram.ext._application.Application.add_handler(handler:BaseHandler[Any, CCT, Any], group:int=DEFAULT_GROUP) -> NoneRegister a handler.
method
src.telegram.ext._application.Application.builder() -> 'InitApplicationBuilder'Convenience method.
method
src.telegram.ext._application.Application.remove_error_handler(callback:HandlerCallback[object, CCT, None]) -> NoneRemoves an error handler.
method
src.telegram.ext._application.Application.remove_handler(handler:BaseHandler[Any, CCT, Any], group:int=DEFAULT_GROUP) -> NoneRemove a handler from the specified group.
method
src.telegram.ext._baseratelimiter.BaseRateLimiter.initialize() -> NoneInitialize resources used by this class.
method
src.telegram.ext._baseratelimiter.BaseRateLimiter.shutdown() -> NoneStop & clear resources used by this class.
method
src.telegram.ext._callbackcontext.CallbackContext.bot_data() -> BD:obj:`ContextTypes.bot_data`: Optional.
method
src.telegram.ext._callbackcontext.CallbackContext.chat_data() -> CD | None:obj:`ContextTypes.chat_data`: Optional.
method
src.telegram.ext._callbackcontext.CallbackContext.update(data:dict[str, object]) -> NoneUpdates ``self.__slots__`` with the passed data.
method
src.telegram.ext._callbackcontext.CallbackContext.user_data() -> UD | None:obj:`ContextTypes.user_data`: Optional.
class
src.telegram.ext._handlers.basehandler.BaseHandlerThe base class for all update handlers.
class
src.telegram.ext._handlers.commandhandler.CommandHandlerHandler class to handle Telegram commands.
class
src.telegram.ext._handlers.messagehandler.MessageHandlerHandler class to handle Telegram messages.
class
src.telegram.ext._handlers.stringcommandhandler.StringCommandHandlerHandler class to handle string commands.
method
src.telegram.ext._jobqueue.Job.enabled() -> bool:obj:`bool`: Whether this job is enabled.
class
src.telegram.ext._utils.webhookhandler.WebhookAppClassApplication used in the Webserver
class
src.telegram.ext.filters.BaseFilterBase class for all Filters.
method
src.telegram.ext.filters.BaseFilter.name() -> str:obj:`str`: Name for this filter.
class
src.telegram.ext.filters.CaptionMessages with a caption.
method
src.telegram.ext.filters.Chat.add_chat_ids(chat_id:SCT[int]) -> NoneAdd one or more chats to the allowed chat ids.
method
src.telegram.ext.filters.Chat.remove_chat_ids(chat_id:SCT[int]) -> NoneRemove one or more chats from allowed chat ids.
class
src.telegram.ext.filters.ChatTypeSubset for filtering the type of chat.
class
src.telegram.ext.filters.DiceDice Messages.
class
src.telegram.ext.filters.Dice.BasketballDice messages with the emoji 🏀.
class
src.telegram.ext.filters.Dice.BowlingDice messages with the emoji 🎳.
class
src.telegram.ext.filters.Dice.DartsDice messages with the emoji 🎯.
class
src.telegram.ext.filters.Dice.DiceDice messages with the emoji 🎲.
class
src.telegram.ext.filters.Dice.FootballDice messages with the emoji ⚽.
class
src.telegram.ext.filters.Dice.SlotMachineDice messages with the emoji 🎰.
class
src.telegram.ext.filters.DocumentSubset for messages containing a document/file.
class
src.telegram.ext.filters.MessageFilterBase class for all Message Filters.
method
src.telegram.ext.filters.MessageFilter.filter(message:Message) -> bool | FilterDataDict | NoneThis method must be overwritten.
class
src.telegram.ext.filters.StatusUpdateSubset for messages containing a status update.
class
src.telegram.ext.filters.StickerFilters messages which contain a sticker.
class
src.telegram.ext.filters.SuccessfulPaymentSuccessful Payment Messages.
class
src.telegram.ext.filters.TextText Messages.
class
src.telegram.ext.filters.UpdateFilterBase class for all Update Filters.
method
src.telegram.ext.filters.UpdateFilter.filter(update:Update) -> bool | FilterDataDict | NoneThis method must be overwritten.
class
src.telegram.ext.filters.UpdateTypeSubset for filtering the type of update.
method
src.telegram.ext.filters.User.add_user_ids(user_id:SCT[int]) -> NoneAdd one or more users to the allowed user ids.
method
src.telegram.ext.filters.User.remove_user_ids(user_id:SCT[int]) -> NoneRemove one or more users from allowed user ids.
method
src.telegram.ext.filters.User.user_ids() -> frozenset[int]Which user ID(s) to allow through.
func
src.telegram.helpers.escape_markdown(text:str, version:MarkdownVersion=1, entity_type:str | None=None) -> strHelper function to escape telegram markup symbols.
func
src.telegram.helpers.mention_html(user_id:int | str, name:str) -> strHelper function to create a user mention as HTML tag.
class
src.telegram.warnings.PTBDeprecationWarningCustom warning class for deprecations in this library.
About this data
These signatures were extracted from the public source of python-telegram-bot/python-telegram-bot
using Python's ast module. Argument names, default values,
type annotations and return types are taken verbatim from the code.
Implementation bodies are never stored. See
how it works for details.