mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-22 18:29:14 +02:00
Who's That Pokemon Accept many languages
This commit is contained in:
@@ -19,7 +19,8 @@ module.exports = class WhosThatPokemonCommand extends Command {
|
|||||||
const pokemon = Math.floor(Math.random() * 721) + 1;
|
const pokemon = Math.floor(Math.random() * 721) + 1;
|
||||||
const { body } = await snekfetch
|
const { body } = await snekfetch
|
||||||
.get(`https://pokeapi.co/api/v2/pokemon-species/${pokemon}`);
|
.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 id = `${'000'.slice(body.id.toString().length)}${body.id}`;
|
||||||
const embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setTitle('You have 15 seconds, who\'s that Pokémon?')
|
.setTitle('You have 15 seconds, who\'s that Pokémon?')
|
||||||
@@ -31,7 +32,7 @@ module.exports = class WhosThatPokemonCommand extends Command {
|
|||||||
time: 15000
|
time: 15000
|
||||||
});
|
});
|
||||||
if (!msgs.size) return msg.say(`Time! It was ${name}, sorry!`);
|
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!');
|
return msg.say('Nice job! 10/10! You deserve some cake!');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiaobot",
|
"name": "xiaobot",
|
||||||
"version": "31.2.0",
|
"version": "31.2.1",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Shard.js",
|
"main": "Shard.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user