Search code examples
telegramtelegram-bot

How to create a three dashes menu on a Telegram bot?


How could I create a three-dashes menus on a Telegram bot, similarly to what they do to the Jobs bot? It should be similar to this:

How do we call this kind of menu?


Solution

  • In java case with this library.

    if the commands already was created, so simply in the class that extends TelegramLongPollingBot:

     this.execute(new GetMyCommands());
    

    In other case:

    1. Create new List BotCommand

      List<> commandsList = new ArrayList();

    2. Adding BotCommand to the list with name and description

      commandsList.add(new BotCommand("commandName", "description"));

    3. Create a new SetMyCommands whit the botCommandList and executed

      this.execute(new SetMyCommands(commands));

    more information about: https://telegram.org/blog/animated-backgrounds#bot-menu