cardboardbox/commands/Fun/roll.js

53 lines
1 KiB
JavaScript
Raw Normal View History

2019-12-23 03:22:04 +00:00
const Roll = require('roll');
const roller = new Roll();
exports.run = async (client, message, args, level) => {
if (!args[0]) {
message.delete();
return (await message.reply("you must specify in dice notation (XdY).")).delete(5000);
}
let reason = '';
let footer = '';
footer += `:game_die: **${args[0]}**`;
if (args.length > 1) {
reason = args.splice(1).join(' ');
2019-12-24 04:21:52 +00:00
footer += ` | Reason: ${reason}`;
2019-12-23 03:22:04 +00:00
}
let results = roller.roll(args[0]);
message.delete();
let embed = client.embed(
`Total: ${results.result}`,
`${[].concat.apply([], results.rolled).join(', ').substr(0, 1800)}`,
[
{
name: '\u200b',
value: footer
}
2019-12-24 04:21:52 +00:00
],
{
2019-12-24 15:38:30 +00:00
author: `Rolled by ${message.author.tag}`,
authorURL: message.author.avatarURL
2019-12-24 04:21:52 +00:00
}
2019-12-23 03:22:04 +00:00
);
message.channel.send({ embed });
};
exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: "User"
};
exports.help = {
name: "roll",
category: "Fun",
description: "Rolls X dice with Y sides. Supports standard dice notation.",
usage: "roll <XdY> [reason]"
};