Files
xiao/commands/response/roll.js
T
Daniel Odendahl Jr 8d3613773a say, embed, and code
2017-03-25 23:14:29 +00:00

34 lines
1.0 KiB
JavaScript

const commando = require('discord.js-commando');
module.exports = class RollChooseCommand extends commando.Command {
constructor(Client) {
super(Client, {
name: 'roll',
aliases: [
'randomnumber',
'dice'
],
group: 'response',
memberName: 'roll',
description: 'Rolls a Dice of your choice. (;roll 6)',
examples: [';roll 6'],
args: [{
key: 'number',
prompt: 'Which number do you want to roll?',
type: 'integer',
default: 6
}]
});
}
run(message, args) {
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log(`[Command] ${message.content}`);
let value = args.number;
let roll = Math.floor(Math.random() * value) + 1;
return message.say(`You rolled a ${roll}.`);
}
};