setChatMenuButton

Returns: bool

class aiogram.methods.set_chat_menu_button.SetChatMenuButton(*, chat_id: int | None = None, menu_button: MenuButtonCommands | MenuButtonWebApp | MenuButtonDefault | None = None, **extra_data: Any)[source]

Use this method to change the bot’s menu button in a private chat, or the default menu button. Returns True on success.

Source: https://core.telegram.org/bots/api#setchatmenubutton

chat_id: int | None

Unique identifier for the target private chat. If not specified, default bot’s menu button will be changed

model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

menu_button: MenuButtonCommands | MenuButtonWebApp | MenuButtonDefault | None

A JSON-serialized object for the bot’s new menu button. Defaults to aiogram.types.menu_button_default.MenuButtonDefault

Usage

As bot method

result: bool = await bot.set_chat_menu_button(...)

Method as object

Imports:

  • from aiogram.methods.set_chat_menu_button import SetChatMenuButton

  • alias: from aiogram.methods import SetChatMenuButton

With specific bot

result: bool = await bot(SetChatMenuButton(...))

As reply into Webhook in handler

return SetChatMenuButton(...)