From 29ef7b8fea1e9ea63da7f483485877b2e439d2fa Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Wed, 25 Mar 2020 21:15:35 -0400 Subject: [PATCH] Allow getting a specific pokemon as a test in whos-that-pokemon --- commands/games-sp/whos-that-pokemon.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/commands/games-sp/whos-that-pokemon.js b/commands/games-sp/whos-that-pokemon.js index a6d6acf9..18641f4d 100644 --- a/commands/games-sp/whos-that-pokemon.js +++ b/commands/games-sp/whos-that-pokemon.js @@ -4,6 +4,7 @@ const request = require('node-superfetch'); const { list } = require('../../util/Util'); const { silhouette } = require('../../util/Canvas'); const difficulties = ['easy', 'hard']; +const pokemonCount = 807; module.exports = class WhosThatPokemonCommand extends Command { constructor(client) { @@ -43,13 +44,20 @@ module.exports = class WhosThatPokemonCommand extends Command { oneOf: difficulties, parse: difficulty => difficulty.toLowerCase(), default: 'hard' + }, + { + key: 'pokemon', + prompt: 'What Pokémon do you want to use?', + type: 'integer', + max: pokemonCount, + min: 0, + default: () => Math.floor(Math.random() * (pokemonCount + 1)) } ] }); } - async run(msg, { difficulty }) { - const pokemon = Math.floor(Math.random() * 808); + async run(msg, { difficulty, pokemon }) { try { const data = await this.client.pokemon.fetch(pokemon.toString()); const names = data.names.map(name => name.name.toLowerCase());