diff --git a/commands/choose.js b/commands/choose.js index 178ff5d..99e3aaf 100644 --- a/commands/choose.js +++ b/commands/choose.js @@ -4,13 +4,14 @@ module.exports = { description: "Give some lines of input, and get one back at random", async execute(client, message, _, config) { - var strarr = message.content.split(/\s*\n\s*/); - strarr[0] = strarr[0].slice(this.name.length + config.prefix.length); - const answer = strarr[Math.floor(Math.random() * strarr.length)]; - - if (answer === "") { + var [head, ...options] = message.content.split(/\s*\n\s*/); + head = head.slice(this.name.length + config.prefix.length); + if (head) options.push(head); + + if (!options.length) { await message.channel.send(client.generateErrorMessage("You need to provide some input!", message.author.displayAvatarURL())); } else { + const answer = options[Math.floor(Math.random() * options.length)]; await message.channel.send({embed: { "title": "I have made my decision:", "description": answer,