mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-23 10:02:05 +02:00
Destructuring Args
This commit is contained in:
@@ -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}.`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user