Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
python-telegram-bot
v22.1
Logo
python-telegram-bot
v22.1

Reference

  • telegram package
    • Bot
    • Available Types
      • AcceptedGiftTypes
      • Animation
      • Audio
      • Birthdate
      • BotCommand
      • BotCommandScope
      • BotCommandScopeAllChatAdministrators
      • BotCommandScopeAllGroupChats
      • BotCommandScopeAllPrivateChats
      • BotCommandScopeChat
      • BotCommandScopeChatAdministrators
      • BotCommandScopeChatMember
      • BotCommandScopeDefault
      • BotDescription
      • BotName
      • BotShortDescription
      • BusinessBotRights
      • BusinessConnection
      • BusinessIntro
      • BusinessLocation
      • BusinessOpeningHours
      • BusinessOpeningHoursInterval
      • BusinessMessagesDeleted
      • CallbackQuery
      • Chat
      • ChatAdministratorRights
      • ChatBackground
      • CopyTextButton
      • BackgroundType
      • BackgroundTypeFill
      • BackgroundTypeWallpaper
      • BackgroundTypePattern
      • BackgroundTypeChatTheme
      • BackgroundFill
      • BackgroundFillSolid
      • BackgroundFillGradient
      • BackgroundFillFreeformGradient
      • ChatBoost
      • ChatBoostAdded
      • ChatBoostRemoved
      • ChatBoostSource
      • ChatBoostSourceGiftCode
      • ChatBoostSourceGiveaway
      • ChatBoostSourcePremium
      • ChatBoostUpdated
      • ChatFullInfo
      • 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
      • GiftInfo
      • Giveaway
      • GiveawayCompleted
      • GiveawayCreated
      • GiveawayWinners
      • InaccessibleMessage
      • InlineKeyboardButton
      • InlineKeyboardMarkup
      • InputFile
      • InputMedia
      • InputMediaAnimation
      • InputMediaAudio
      • InputMediaDocument
      • InputMediaPhoto
      • InputMediaVideo
      • InputPaidMedia
      • InputPaidMediaPhoto
      • InputPaidMediaVideo
      • InputProfilePhoto
      • InputProfilePhotoAnimated
      • InputProfilePhotoStatic
      • InputPollOption
      • InputStoryContent
      • InputStoryContentPhoto
      • InputStoryContentVideo
      • KeyboardButton
      • KeyboardButtonPollType
      • KeyboardButtonRequestChat
      • KeyboardButtonRequestUsers
      • LinkPreviewOptions
      • Location
      • LocationAddress
      • LoginUrl
      • MaybeInaccessibleMessage
      • MenuButton
      • MenuButtonCommands
      • MenuButtonDefault
      • MenuButtonWebApp
      • Message
      • MessageAutoDeleteTimerChanged
      • MessageEntity
      • MessageId
      • MessageOrigin
      • MessageOriginChannel
      • MessageOriginChat
      • MessageOriginHiddenUser
      • MessageOriginUser
      • MessageReactionCountUpdated
      • MessageReactionUpdated
      • OwnedGift
      • OwnedGiftRegular
      • OwnedGifts
      • OwnedGiftUnique
      • PaidMedia
      • PaidMediaInfo
      • PaidMediaPhoto
      • PaidMediaPreview
      • PaidMediaPurchased
      • PaidMediaVideo
      • PhotoSize
      • Poll
      • PollAnswer
      • PollOption
      • ProximityAlertTriggered
      • ReactionCount
      • ReactionType
      • ReactionTypeCustomEmoji
      • ReactionTypeEmoji
      • ReactionTypePaid
      • ReplyKeyboardMarkup
      • ReplyKeyboardRemove
      • ReplyParameters
      • SentWebAppMessage
      • SharedUser
      • Story
      • StoryArea
      • StoryAreaPosition
      • StoryAreaType
      • StoryAreaTypeLink
      • StoryAreaTypeLocation
      • StoryAreaTypeSuggestedReaction
      • StoryAreaTypeUniqueGift
      • StoryAreaTypeWeather
      • SwitchInlineQueryChosenChat
      • TelegramObject
      • TextQuote
      • UniqueGift
      • UniqueGiftBackdrop
      • UniqueGiftBackdropColors
      • UniqueGiftInfo
      • UniqueGiftModel
      • UniqueGiftSymbol
      • Update
      • User
      • UserChatBoosts
      • UserProfilePhotos
      • UsersShared
      • Venue
      • Video
      • VideoChatEnded
      • VideoChatParticipantsInvited
      • VideoChatScheduled
      • VideoChatStarted
      • VideoNote
      • Voice
      • WebAppData
      • WebAppInfo
      • WebhookInfo
      • WriteAccessAllowed
    • Stickers
      • Gift
      • Gifts
      • InputSticker
      • 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
      • PreparedInlineMessage
    • Payments
      • AffiliateInfo
      • Invoice
      • LabeledPrice
      • OrderInfo
      • PreCheckoutQuery
      • RefundedPayment
      • RevenueWithdrawalState
      • RevenueWithdrawalStateFailed
      • RevenueWithdrawalStatePending
      • RevenueWithdrawalStateSucceeded
      • ShippingAddress
      • ShippingOption
      • ShippingQuery
      • StarAmount
      • StarTransaction
      • StarTransactions
      • SuccessfulPayment
      • TransactionPartner
      • TransactionPartnerAffiliateProgram
      • TransactionPartnerChat
      • TransactionPartnerFragment
      • TransactionPartnerOther
      • TransactionPartnerTelegramAds
      • TransactionPartnerTelegramApi
      • TransactionPartnerUser
    • 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
  • telegram.ext package
    • Application
    • ApplicationBuilder
    • ApplicationHandlerStop
    • BaseUpdateProcessor
    • CallbackContext
    • ContextTypes
    • Defaults
    • ExtBot
    • Job
    • JobQueue
    • SimpleUpdateProcessor
    • Updater
    • Handlers
      • BaseHandler
      • BusinessConnectionHandler
      • BusinessMessagesDeletedHandler
      • CallbackQueryHandler
      • ChatBoostHandler
      • ChatJoinRequestHandler
      • ChatMemberHandler
      • ChosenInlineResultHandler
      • CommandHandler
      • ConversationHandler
      • filters Module
      • InlineQueryHandler
      • MessageHandler
      • MessageReactionHandler
      • PaidMediaPurchasedHandler
      • PollAnswerHandler
      • PollHandler
      • PreCheckoutQueryHandler
      • PrefixHandler
      • ShippingQueryHandler
      • StringCommandHandler
      • StringRegexHandler
      • TypeHandler
    • Persistence
      • BasePersistence
      • DictPersistence
      • PersistenceInput
      • PicklePersistence
    • Arbitrary Callback Data
      • CallbackDataCache
      • InvalidCallbackData
    • Rate Limiting
      • BaseRateLimiter
      • AIORateLimiter
  • Auxiliary modules
    • telegram.constants Module
    • telegram.error Module
    • telegram.helpers Module
    • telegram.request Module
      • BaseRequest
      • RequestData
      • HTTPXRequest
    • telegram.warnings Module
  • Telegrams Bot API Docs

Resources

  • Examples
    • arbitrarycallbackdatabot.py
    • chatmemberbot.py
    • contexttypesbot.py
    • conversationbot.py
    • conversationbot2.py
    • customwebhookbot.py
    • deeplinking.py
    • echobot.py
    • errorhandlerbot.py
    • inlinebot.py
    • inlinekeyboard.py
    • inlinekeyboard2.py
    • nestedconversationbot.py
    • passportbot.py
    • paymentbot.py
    • persistentconversationbot.py
    • pollbot.py
    • rawapibot.py
    • timerbot.py
    • webappbot.py
  • Wiki

Project

  • Stability Policy
  • Changelog
  • Contributor Covenant Code of Conduct
  • How To Contribute
  • Testing in PTB
  • Website
  • GitHub Repository
  • Telegram Channel
  • Telegram User Group
Back to top
View this page
Edit this page

MenuButton¶

class telegram.MenuButton(type, *, api_kwargs=None)[source]¶

Bases: telegram.TelegramObject

This object describes the bot’s menu button in a private chat. It should be one of

  • telegram.MenuButtonCommands

  • telegram.MenuButtonWebApp

  • telegram.MenuButtonDefault

If a menu button other than telegram.MenuButtonDefault is set for a private chat, then it is applied in the chat. Otherwise the default menu button is applied. By default, the menu button opens the list of bot commands.

Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their type is equal. For subclasses with additional attributes, the notion of equality is overridden.

Use In

telegram.Bot.set_chat_menu_button()

Returned In

telegram.Bot.get_chat_menu_button()

Added in version 20.0.

Parameters:

type (str) – Type of menu button that the instance represents.

type[source]¶

Type of menu button that the instance represents.

Type:

str

COMMANDS = 'commands'[source]¶

telegram.constants.MenuButtonType.COMMANDS

DEFAULT = 'default'[source]¶

telegram.constants.MenuButtonType.DEFAULT

WEB_APP = 'web_app'[source]¶

telegram.constants.MenuButtonType.WEB_APP

classmethod de_json(data, bot=None)[source]¶

Converts JSON data to the appropriate MenuButton object, i.e. takes care of selecting the correct subclass.

Parameters:
  • data (dict[str, …]) – The JSON data.

  • bot (telegram.Bot, optional) –

    The bot associated with this object. Defaults to None, in which case shortcut methods will not be available.

    Changed in version 21.4: bot is now optional and defaults to None

Returns:

The Telegram object.

Next
MenuButtonCommands
Previous
MaybeInaccessibleMessage
Copyright © 2015-2025, Leandro Toledo
Made with Sphinx and @pradyunsg's Furo
On this page
  • MenuButton
    • MenuButton
      • MenuButton.type
      • MenuButton.COMMANDS
      • MenuButton.DEFAULT
      • MenuButton.WEB_APP
      • MenuButton.de_json()