skip to Main Content

the same list

When you type "/" in the telegram bot, a menu appears with possible commands and their descriptions. I know this is done with types.BotCommand (), however I cannot figure out how to apply it correctly.

2

Answers


  1. Just found one answer but not sure that it works well…

    from aiogram import types
    
    async def set_default_commands(dp):
        await dp.bot.set_my_commands([
            types.BotCommand("start", "Запустить бота"),
            types.BotCommand("help", "Помощь"),
            types.BotCommand("test", "Тест"),
            types.BotCommand("form", "Форма"),
            types.BotCommand("menu", "Меню"),
        ])
    
    Login or Signup to reply.
  2. from aiogram import types
    
    
    async def commands_list_menu(disp):
            await disp.bot.set_my_commands([
                types.BotCommand("start", "Start"),
                types.BotCommand("help", "Help"),
                types.BotCommand("settings", "Settings"),
        ])
    

    then clear bot history and restart the bot, it’s worked)

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search