set_bot_commands()

Client.set_bot_commands()

Set the bot commands list.

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

Parameters

commands (List of BotCommand) – A list of bot commands. Pass None to remove all commands.

Returns

bool – True on success, False otherwise.

Example

from pyrogram.types import BotCommand

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

# Remove commands
app.set_bot_commands(None)