A
A
Alexander2021-11-04 21:57:00
JavaScript
Alexander, 2021-11-04 21:57:00

How to get callback data when clicking Markup.keyboard Telegraf?

Please tell me how to get callback data when clicking on Markup.keyboard?
It is necessary to get callback data from the usual Markup.keyboard
I would be very grateful for the answer

Not working code, action is not executed:

bot.hears(' Search', async (ctx) => {
    return await ctx.reply(
      'Custom buttons keyboard',
      Markup.keyboard([Markup.button.callback('TEST', 'test')])
        .oneTime()
        .resize()
    )
  })

  bot.action('test',  async (ctx) => {
    console.log('ctx)
    return await ctx.reply(
      'Custom buttons keyboard',
      Markup.keyboard()
        .oneTime()
        .resize()
)
  })

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question