skip to Main Content

I would like to know how I can create a "command sequence" like the one in the image below, I’m using the TELEGRAF module in nodejs

Imagem

1

Can’t do this function

2

Answers


  1. You can achieve that by calling directly telegram api .setMyCommands:

    const { Telegraf } = require('telegraf');
    
    const bot = new Telegraf(process.env.BOT_TOKEN);
    
    bot.telegram.setMyCommands([
      {
        name: 'test',
        description: 'Test command',
      },
      {
        name: 'greetings',
        description: 'Greetings command',
      }
    ]);
    
    bot.command('greetings', (ctx) => ctx.reply('Hello!!!')); 
    
    bot.launch();
    
    process.once('SIGINT', () => bot.stop('SIGINT'));
    process.once('SIGTERM', () => bot.stop('SIGTERM'));
    

    or You can do it using telegram app:

    1. Talk to BotFather
    2. Send him /setcommands
    3. Pick the bot which You want to set command menu.

    setting commands

    testing commands

    Login or Signup to reply.
  2. Now it’s not

    name: 'test'
    

    Right is

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