Search code examples
node.jstelegram-bottelegraf.js

how to create a chat menu button in telegrafjs


im creating a telegram bot using nodejs and telegrafjs i want to know how to create this menu button i cant find anywhere in documents.

enter image description here

it opens up a menu like this one

enter image description here


Solution

  • Check this examples

    bot.command('your command', async (ctx) => {
      return await ctx.reply('this is text', Markup
        .keyboard([
          ['button 1', 'button 2'], // Row1 with 2 buttons
          ['button 3', 'button 4'], // Row2 with 2 buttons
          ['button 5', 'button 6', 'button 7'] // Row3 with 3 buttons
        ])
        .oneTime()
        .resize()
      )
    })