kowalski/commands/random.js
mthlma fd3196a34f
Update README.md + Translations (#6)
* Update README.md

Now we don't have config.env anymore, we now use config.json inside props folder

* Add portuguese.json

* Set portuguese language if  user's telegram app is in portuguese

* oh fudge, I forgot this one

---------

Co-authored-by: GiovaniFZ <giovanifinazzi@gmail.com>
2024-07-25 23:40:22 -03:00

20 lines
501 B
JavaScript

const { getStrings } = require('./checklang');
function getRandomInt(max) {
return Math.floor(Math.random() * max);
}
module.exports = (bot) => {
bot.command('random', (ctx) => {
const Strings = getStrings(ctx.from.language_code);
const randomValue = getRandomInt(11);
const randomVStr = Strings.randomNum.replace('{number}', randomValue);
ctx.reply(
randomVStr, {
parse_mode: 'Markdown',
reply_to_message_id: ctx.message.message_id
}
);
});
};