From b5f4351d48f1e26f21222249204fb87a7390ec01 Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Sat, 25 Mar 2017 06:02:19 +0000 Subject: [PATCH] || and toLowerCase added seperate places --- commands/games/mathgame.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/commands/games/mathgame.js b/commands/games/mathgame.js index 2e09229a..7298ce72 100644 --- a/commands/games/mathgame.js +++ b/commands/games/mathgame.js @@ -15,16 +15,7 @@ module.exports = class MathGameCommand extends commando.Command { prompt: 'What difficulty should the math game be? easy, medium, hard, or extreme?', type: 'string', validate: difficulty => { - if (difficulty.toLowerCase() === 'easy') { - return true; - } - else if (difficulty.toLowerCase() === 'medium') { - return true; - } - else if (difficulty.toLowerCase() === 'hard') { - return true; - } - else if (difficulty.toLowerCase() === 'extreme') { + if (difficulty.toLowerCase() === 'easy' || difficulty.toLowerCase() === 'medium' || difficulty.toLowerCase() === 'hard' || difficulty.toLowerCase() === 'extreme') { return true; } return 'Please set the difficulty to either `easy`, `medium`, `hard`, or `extreme`.'; @@ -38,7 +29,7 @@ module.exports = class MathGameCommand extends commando.Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return; } console.log(`[Command] ${message.content}`); - let level = args.difficulty; + let level = args.difficulty.toLowerCase(); let randomType = ['+', '-', '*']; randomType = randomType[Math.floor(Math.random() * randomType.length)]; let randomValue;