From edd5fa79ee2573b47b84ce3f32e4b12196ecf610 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Thu, 3 Dec 2020 10:35:46 -0500 Subject: [PATCH] Add Abilities --- assets/json/missingno.json | 1 + commands/search/pokedex.js | 3 ++- package.json | 2 +- structures/pokemon/Pokemon.js | 5 +++++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/assets/json/missingno.json b/assets/json/missingno.json index d1ce0cdd..1c46148f 100644 --- a/assets/json/missingno.json +++ b/assets/json/missingno.json @@ -64,6 +64,7 @@ "sDef": 6, "spd": 29 }, + "abilities": ["N/A"], "chain": [0], "missingno": true, "sprite": "https://cdn.bulbagarden.net/upload/9/98/Missingno_RB.png", diff --git a/commands/search/pokedex.js b/commands/search/pokedex.js index 5dc3fa54..bcfc1fc3 100644 --- a/commands/search/pokedex.js +++ b/commands/search/pokedex.js @@ -103,7 +103,8 @@ module.exports = class PokedexCommand extends Command { \`Sp. Attack: [${'█'.repeat(repeat.sAtk)}${' '.repeat(20 - repeat.sAtk)}]\` **${data.stats.sAtk}** \`Sp. Defense: [${'█'.repeat(repeat.sDef)}${' '.repeat(20 - repeat.sDef)}]\` **${data.stats.sDef}** \`Speed: [${'█'.repeat(repeat.spd)}${' '.repeat(20 - repeat.spd)}]\` **${data.stats.spd}** - `); + `) + .addField('❯ Abilities', data.abilities.join(' / ')); if (data.cry) { const connection = msg.guild ? this.client.voice.connections.get(msg.guild.id) : null; if (connection) { diff --git a/package.json b/package.json index ed2c7939..856b3ec9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "123.2.1", + "version": "123.2.2", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": { diff --git a/structures/pokemon/Pokemon.js b/structures/pokemon/Pokemon.js index 0c9758ce..47ffc7f2 100644 --- a/structures/pokemon/Pokemon.js +++ b/structures/pokemon/Pokemon.js @@ -37,6 +37,7 @@ module.exports = class Pokemon { data: data.missingno ? missingno.chain : data.evolution_chain ? [] : [data.id] }; this.stats = data.missingno ? data.stats : null; + this.abilities = data.missingno ? data.abilities : null; this.gameDataCached = data.missingno || false; this.missingno = data.missingno || false; this.cry = data.id > store.pokemonCountWithCry @@ -92,6 +93,10 @@ module.exports = class Pokemon { variety.display = true; } } + for (const ability of defaultBody.abilities) { + const { body } = await request.get(ability.ability.url); + this.abilities.push(body.names.find(name => name.language.name === 'en').name); + } this.gameDataCached = true; return this; }