mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-07 23:05:04 +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 { list } = require('../../util/Util');
|
||||||
const { silhouette } = require('../../util/Canvas');
|
const { silhouette } = require('../../util/Canvas');
|
||||||
const difficulties = ['easy', 'hard'];
|
const difficulties = ['easy', 'hard'];
|
||||||
|
const pokemonCount = 807;
|
||||||
|
|
||||||
module.exports = class WhosThatPokemonCommand extends Command {
|
module.exports = class WhosThatPokemonCommand extends Command {
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
@@ -43,13 +44,20 @@ module.exports = class WhosThatPokemonCommand extends Command {
|
|||||||
oneOf: difficulties,
|
oneOf: difficulties,
|
||||||
parse: difficulty => difficulty.toLowerCase(),
|
parse: difficulty => difficulty.toLowerCase(),
|
||||||
default: 'hard'
|
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 }) {
|
async run(msg, { difficulty, pokemon }) {
|
||||||
const pokemon = Math.floor(Math.random() * 808);
|
|
||||||
try {
|
try {
|
||||||
const data = await this.client.pokemon.fetch(pokemon.toString());
|
const data = await this.client.pokemon.fetch(pokemon.toString());
|
||||||
const names = data.names.map(name => name.name.toLowerCase());
|
const names = data.names.map(name => name.name.toLowerCase());
|
||||||
|
|||||||
Reference in New Issue
Block a user