mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-17 08:17:35 +02:00
Include chain fetch in game data
This commit is contained in:
@@ -62,7 +62,6 @@ module.exports = class PokedexCommand extends Command {
|
|||||||
const data = await this.client.pokemon.fetch(pokemon);
|
const data = await this.client.pokemon.fetch(pokemon);
|
||||||
if (!data) return msg.say('Could not find any results.');
|
if (!data) return msg.say('Could not find any results.');
|
||||||
if (!data.gameDataCached) await data.fetchGameData();
|
if (!data.gameDataCached) await data.fetchGameData();
|
||||||
if (!data.chain.data.length) await data.fetchChain();
|
|
||||||
const typesShown = data.varieties.filter(variety => variety.display);
|
const typesShown = data.varieties.filter(variety => variety.display);
|
||||||
const repeat = {
|
const repeat = {
|
||||||
hp: Math.round((data.stats.hp / 255) * 10) * 2,
|
hp: Math.round((data.stats.hp / 255) * 10) * 2,
|
||||||
|
|||||||
@@ -97,6 +97,7 @@ module.exports = class Pokemon {
|
|||||||
const { body } = await request.get(ability.ability.url);
|
const { body } = await request.get(ability.ability.url);
|
||||||
this.abilities.push(body.names.find(name => name.language.name === 'en').name);
|
this.abilities.push(body.names.find(name => name.language.name === 'en').name);
|
||||||
}
|
}
|
||||||
|
await this.fetchChain();
|
||||||
this.gameDataCached = true;
|
this.gameDataCached = true;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user