Skip to content

Instantly share code, notes, and snippets.

@ejnshtein
Last active September 27, 2018 19:38
Show Gist options
  • Save ejnshtein/8cf694a0cf1c33647625bfacd7bcca60 to your computer and use it in GitHub Desktop.
Save ejnshtein/8cf694a0cf1c33647625bfacd7bcca60 to your computer and use it in GitHub Desktop.
bot.start((ctx) => {
if (ctx.chat.id == config.adminID) {
} else
ctx.reply('Привет! Проголодался? У нас есть чем накормить тебя!', makeKeyboard(['📖 Меню', '🛒 Корзина', '📍 Все рестораны']))
})
cosnt makeKeyboard = buttons => {
const keyboard = []
let line = []
buttons.forEach(button => {
if (line.length >= 2) {
keyboard.push(line)
line = [button]
} else {
line.push(button)
}
})
if (line.length) { keyboard.push(line) }
return {reply_markup: { keyboard: keyboard, resize_keyboard: true } }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment