getMyCommands

Returns: list[BotCommand]

class aiogram.methods.get_my_commands.GetMyCommands(*, scope: BotCommandScopeDefault | BotCommandScopeAllPrivateChats | BotCommandScopeAllGroupChats | BotCommandScopeAllChatAdministrators | BotCommandScopeChat | BotCommandScopeChatAdministrators | BotCommandScopeChatMember | None = None, language_code: str | None = None, **extra_data: Any)[source]

Use this method to get the current list of the bot’s commands for the given scope and user language. Returns an Array of aiogram.types.bot_command.BotCommand objects. If commands aren’t set, an empty list is returned.

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

scope: BotCommandScopeDefault | BotCommandScopeAllPrivateChats | BotCommandScopeAllGroupChats | BotCommandScopeAllChatAdministrators | BotCommandScopeChat | BotCommandScopeChatAdministrators | BotCommandScopeChatMember | None

A JSON-serialized object, describing scope of users. Defaults to aiogram.types.bot_command_scope_default.BotCommandScopeDefault.

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.

language_code: str | None

A two-letter ISO 639-1 language code or an empty string

Usage

As bot method

result: list[BotCommand] = await bot.get_my_commands(...)

Method as object

Imports:

  • from aiogram.methods.get_my_commands import GetMyCommands

  • alias: from aiogram.methods import GetMyCommands

With specific bot

result: list[BotCommand] = await bot(GetMyCommands(...))