telegram.MenuButton

class telegram.MenuButton(type, **_kwargs)

Bases: telegram.base.TelegramObject

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

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.

New in version 13.12.

Parameters

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

type

Type of menu button that the instance represents.

Type

str

COMMANDS: ClassVar[str] = 'commands'

telegram.constants.MENU_BUTTON_COMMANDS

DEFAULT: ClassVar[str] = 'default'

telegram.constants.MENU_BUTTON_DEFAULT

WEB_APP: ClassVar[str] = 'web_app'

telegram.constants.MENU_BUTTON_WEB_APP

classmethod de_json(data, bot)

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) – The bot associated with this object.

Returns

The Telegram object.