set_bot_commands()#

Client.set_bot_commands()#

Set the list of the bot’s commands. The commands passed will overwrite any command set previously. This method can be used by the own bot only.

Usable by Users Bots
Parameters:
  • commands (List of BotCommand) – A list of bot commands. At most 100 commands can be specified.

  • scope (BotCommandScope, optional) – An object describing the scope of users for which the commands are relevant. Defaults to BotCommandScopeDefault.

  • language_code (str, optional) – A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands.

Returns:

bool – On success, True is returned.

Example

from pyrogram.types import BotCommand

# Set new commands
await app.set_bot_commands([
    BotCommand("start", "Start the bot"),
    BotCommand("settings", "Bot settings")])