mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-16 08:22:22 +02:00
Duh
This commit is contained in:
@@ -29,9 +29,6 @@ module.exports = class PokedexCommand extends Command {
|
|||||||
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 id = `${'000'.slice(body.id.toString().length)}${body.id}`;
|
const id = `${'000'.slice(body.id.toString().length)}${body.id}`;
|
||||||
console.log(this.filter(body.names));
|
|
||||||
console.log(this.filter(body.flavor_text_entries));
|
|
||||||
console.log(this.filter(body.genera));
|
|
||||||
const name = this.filter(body.names).name;
|
const name = this.filter(body.names).name;
|
||||||
const flavor = this.filter(body.flavor_text_entries).flavor_text.replace(/\n/g, ' ');
|
const flavor = this.filter(body.flavor_text_entries).flavor_text.replace(/\n/g, ' ');
|
||||||
const species = this.filter(body.genera).genus;
|
const species = this.filter(body.genera).genus;
|
||||||
@@ -52,6 +49,7 @@ module.exports = class PokedexCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
filter(arr) {
|
filter(arr) {
|
||||||
return arr.filter(entry => entry.language.name === 'en')[Math.floor(Math.random() * arr.length)];
|
const filtered = arr.filter(entry => entry.language.name === 'en');
|
||||||
|
return filtered[Math.floor(Math.random() * filtered.length)];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user