Destructuring Args

This commit is contained in:
Daniel Odendahl Jr
2017-04-19 12:21:38 +00:00
parent 4fc536531d
commit e105b6aa5d
72 changed files with 228 additions and 167 deletions
+3 -4
View File
@@ -13,10 +13,9 @@ module.exports = class RollCommand extends Command {
description: 'Rolls a Dice of your choice. (;roll 6)',
examples: [';roll 6'],
args: [{
key: 'number',
key: 'value',
prompt: 'Which number do you want to roll?',
type: 'integer',
default: 6
type: 'integer'
}]
});
}
@@ -25,7 +24,7 @@ module.exports = class RollCommand extends Command {
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
const value = args.number;
const { value } = args;
const roll = Math.floor(Math.random() * value) + 1;
return message.say(`You rolled a ${roll}.`);
}