A
A
aassww2021-03-06 20:48:36
Node.js
aassww, 2021-03-06 20:48:36

How to add a keyboard from an array?

How to add all buttons from a certain array to the keyboard?
Not working code:

bot.onText(/\/start/i, async msg => {
  const user = users.filter(x => x.id === msg.from.id)[0]
  const buttons = ["Продолжить", "Назад"]
  const keyboard = {
    reply_keyboard: {
      keyboard: [
        buttons
      ]
    }
  }
  bot.sendMessage(user.id, `Привет, ${user.first_name}!`, keyboard)
})

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex K, 2021-03-06
@thewayofmagic

See the description of the ReplyKeyboardMarkup object in the official Telegram Bot API documentation: https://core.telegram.org/bots/api#replykeyboardmarkup

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question