From 4e03a1e710738f2b69da62a3b2e9921998c9c7af Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Sat, 26 Aug 2017 16:50:36 +0000 Subject: [PATCH] Who's That Pokemon Accept many languages --- commands/games/whos-that-pokemon.js | 5 +++-- package.json | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/commands/games/whos-that-pokemon.js b/commands/games/whos-that-pokemon.js index 3b145304..c0419987 100644 --- a/commands/games/whos-that-pokemon.js +++ b/commands/games/whos-that-pokemon.js @@ -19,7 +19,8 @@ module.exports = class WhosThatPokemonCommand extends Command { const pokemon = Math.floor(Math.random() * 721) + 1; const { body } = await snekfetch .get(`https://pokeapi.co/api/v2/pokemon-species/${pokemon}`); - const name = filterPkmn(body.names).name.toLowerCase(); + const names = body.names.map(name => name.name.toLowerCase()); + const name = filterPkmn(body.names).name; const id = `${'000'.slice(body.id.toString().length)}${body.id}`; const embed = new MessageEmbed() .setTitle('You have 15 seconds, who\'s that Pokémon?') @@ -31,7 +32,7 @@ module.exports = class WhosThatPokemonCommand extends Command { time: 15000 }); if (!msgs.size) return msg.say(`Time! It was ${name}, sorry!`); - if (msgs.first().content.toLowerCase() !== name) return msg.say(`Nope, sorry, it's ${name}.`); + if (!names.includes(msgs.first().content.toLowerCase())) return msg.say(`Nope, sorry, it's ${name}.`); return msg.say('Nice job! 10/10! You deserve some cake!'); } }; diff --git a/package.json b/package.json index 4595507f..a89572d2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiaobot", - "version": "31.2.0", + "version": "31.2.1", "description": "Your personal server companion.", "main": "Shard.js", "scripts": {