mrmBot-Matrix/commands/dice.js

12 lines
417 B
JavaScript
Raw Normal View History

2019-09-13 20:02:41 +00:00
exports.run = async (message, args) => {
if (args.length === 0 || !args[0].match(/^\d+$/)) {
return `🎲 The dice landed on ${Math.floor(Math.random() * 6) + 1}.`;
2019-09-13 20:02:41 +00:00
} else {
return `🎲 The dice landed on ${Math.floor(Math.random() * parseInt(args[0])) + 1}.`;
2019-09-13 20:02:41 +00:00
}
};
exports.aliases = ["roll", "die", "rng", "random"];
exports.category = 4;
exports.help = "Rolls the dice";
exports.params = "{number}";