Choose Changes

This commit is contained in:
Daniel Odendahl Jr
2017-03-22 00:37:11 +00:00
parent 772c370af9
commit f49d87e634
+7 -6
View File
@@ -19,12 +19,13 @@ module.exports = class ChooseCommand extends commando.Command {
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log("[Command] " + message.content);
if(message.content.includes("|")) {
let choice2 = message.content.split("|").slice(1).join(" ");
let choice1 = " " + message.content.replace(choice2, "").split(" ").slice(1).join(" ");
let coin = [choice1, choice2];
coin = coin[Math.floor(Math.random() * coin.length)];
message.channel.send("I choose" + coin.replace("|", ""));
if(message.content.includes(" | ")) {
let choices = message.content.split(" | ");
let choice1 = choices[0];
let choice2 = choices[1];
let randomChoice = [choice1, choice2];
randomChoice = randomChoice[Math.floor(Math.random() * randomChoice.length)];
message.channel.send("I choose " + randomChoice);
} else {
message.channel.send(":x: Split your two choices with a ' | '!");
}