Change in the way choice commands work

This commit is contained in:
Daniel Odendahl Jr
2017-04-11 13:44:43 +00:00
parent 0a3d8dc6a5
commit f0ad17ab4b
6 changed files with 71 additions and 38 deletions
+4 -10
View File
@@ -9,18 +9,13 @@ module.exports = class ChooseCommand extends Command {
],
group: 'response',
memberName: 'choose',
description: 'Chooses between things. (;choose Cow | Sheep)',
examples: [';choose Cow | Sheep', ';choose Bark | Woof | Meow | Moo'],
description: 'Chooses between things. (;choose "Cow" "Sheep")',
examples: [';choose "Cow" "Sheep"', ';choose "Bark" "Woof" "Meow" "Moo"'],
args: [{
key: 'choices',
prompt: 'What choices do you want me pick from? Split them with " | ".',
prompt: 'What choices do you want me pick from? Surround each choice in "".',
type: 'string',
validate: content => {
if (content.includes(' | ')) {
return true;
}
return 'Please split your choices with ' | '.';
}
infinite: true
}]
});
}
@@ -30,7 +25,6 @@ module.exports = class ChooseCommand extends Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
let choices = args.choices;
choices = choices.split(' | ');
choices = choices[Math.floor(Math.random() * choices.length)];
return message.say(`I choose ${choices}!`);
}