From 79a2c9a89b26800d6b2f16ec09b347804c298e7c Mon Sep 17 00:00:00 2001 From: Emily J Date: Tue, 3 Nov 2020 21:47:43 +1100 Subject: [PATCH] use fuzzy search --- bot/commands/Fun/pokemon.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/bot/commands/Fun/pokemon.js b/bot/commands/Fun/pokemon.js index 4b9f3a6..084e04a 100644 --- a/bot/commands/Fun/pokemon.js +++ b/bot/commands/Fun/pokemon.js @@ -22,9 +22,7 @@ module.exports = class { async run (client, message, args, data) { //eslint-disable-line no-unused-vars - - let query = args.join(' '); - query = query.trim(); + const query = args.join(' '); fetch('https://graphqlpokemon.favware.tech/', { method: 'POST', @@ -33,7 +31,7 @@ module.exports = class { }, body: JSON.stringify({ query: ` { - getPokemonDetails(pokemon: ${query}) { + getPokemonDetailsByFuzzy(pokemon: "${query}") { num species types @@ -62,7 +60,7 @@ module.exports = class { }) .then((res) => res.json()) .then((json) => { - const pokemon = json.data.getPokemonDetails; + const pokemon = json.data.getPokemonDetailsByFuzzy; const evoChain = this.parseEvoChain(pokemon); const genderRatio = this.parseGenderRatio(pokemon.gender); const abilities = this.parseAbilities(pokemon.abilities);