From 487550562ea482a65b939d5005ad78c73f65cf23 Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Sat, 25 Mar 2017 05:47:19 +0000 Subject: [PATCH] Fix Validator? --- commands/games/mathgame.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/commands/games/mathgame.js b/commands/games/mathgame.js index 5b57277e..cd8d9414 100644 --- a/commands/games/mathgame.js +++ b/commands/games/mathgame.js @@ -5,8 +5,8 @@ const math = require('mathjs'); module.exports = class MathGameCommand extends commando.Command { constructor(Client) { super(Client, { - name: 'games', - group: 'random', + name: 'mathgame', + group: 'games', memberName: 'mathgame', description: 'See how fast you can answer a math problem in a given time limit. (;mathgame easy)', examples: [';mathgame easy', ';mathgame medium', ';mathgame hard', ';mathgame extreme'], @@ -15,10 +15,19 @@ 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' || difficulty.toLowerCase() !== 'medium' || difficulty.toLowerCase() !== 'hard' || difficulty.toLowerCase() !== 'extreme') { - return 'Please set the difficulty to either `easy`, `medium`, `hard`, or `extreme`.'; + if (difficulty === 'easy') { + return true; } - return true; + else if (difficulty === 'medium') { + return true; + } + else if (difficulty === 'hard') { + return true; + } + else if (difficulty === 'extreme') { + return true; + } + return 'Please set the difficulty to either `easy`, `medium`, `hard`, or `extreme`.'; }, parse: (str) => { str.toLowerCase();