kowalski/commands/random.js

15 lines
396 B
JavaScript
Raw Permalink Normal View History

module.exports = function(bot, msg) {
const chatId = msg.chat.id;
function getRandomInt(max) {
return Math.floor(Math.random() * max);
}
const randomValue = getRandomInt(11);
2024-06-02 15:18:27 +00:00
const message = `*Generated value:* \`${randomValue}\``;
bot.sendMessage(chatId, message, { parse_mode: 'Markdown' })
2024-06-02 13:27:01 +00:00
.catch(error => console.error('WARN: Message cannot be sent: ', error));
}