mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Allow getting a specific pokemon as a test in whos-that-pokemon
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user