mirror of
https://github.com/abocn/TelegramBot.git
synced 2025-03-10 21:00:03 +00:00
15 lines
396 B
JavaScript
15 lines
396 B
JavaScript
module.exports = function(bot, msg) {
|
|
const chatId = msg.chat.id;
|
|
|
|
function getRandomInt(max) {
|
|
return Math.floor(Math.random() * max);
|
|
}
|
|
|
|
const randomValue = getRandomInt(11);
|
|
|
|
const message = `*Generated value:* \`${randomValue}\``;
|
|
|
|
bot.sendMessage(chatId, message, { parse_mode: 'Markdown' })
|
|
.catch(error => console.error('WARN: Message cannot be sent: ', error));
|
|
}
|
|
|