Last active
September 27, 2018 19:38
-
-
Save ejnshtein/8cf694a0cf1c33647625bfacd7bcca60 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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