mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-25 14:21:41 +02:00
Who's That Pokemon Command, Bug Fixes
This commit is contained in:
@@ -48,7 +48,7 @@ module.exports = class OsuCommand extends Command {
|
||||
.addField('❯ Play Count',
|
||||
body[0].playcount, true)
|
||||
.addField('❯ Country',
|
||||
body[0].country, true)
|
||||
body[0].country || 'N/A', true)
|
||||
.addField('❯ Ranked Score',
|
||||
body[0].ranked_score, true)
|
||||
.addField('❯ Total Score',
|
||||
|
||||
@@ -2,6 +2,7 @@ const Command = require('../../structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const snekfetch = require('snekfetch');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const { filterPkmn } = require('../../structures/Util');
|
||||
|
||||
module.exports = class PokedexCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -31,11 +32,11 @@ module.exports = class PokedexCommand extends Command {
|
||||
const id = `${'000'.slice(body.id.toString().length)}${body.id}`;
|
||||
const embed = new MessageEmbed()
|
||||
.setColor(0xED1C24)
|
||||
.setAuthor(`#${id} - ${this.filter(body.names).name}`, `https://www.serebii.net/pokedex-sm/icon/${id}.png`)
|
||||
.setAuthor(`#${id} - ${filterPkmn(body.names).name}`, `https://www.serebii.net/pokedex-sm/icon/${id}.png`)
|
||||
.setURL(`https://www.serebii.net/pokedex-sm/${id}.shtml`)
|
||||
.setDescription(stripIndents`
|
||||
**The ${this.filter(body.genera).genus} Pokémon**
|
||||
${this.filter(body.flavor_text_entries).flavor_text.replace(/(\n|\f|\r)/g, ' ')}
|
||||
**The ${filterPkmn(body.genera).genus} Pokémon**
|
||||
${filterPkmn(body.flavor_text_entries).flavor_text.replace(/(\n|\f|\r)/g, ' ')}
|
||||
`)
|
||||
.setThumbnail(`https://www.serebii.net/sunmoon/pokemon/${id}.png`);
|
||||
return msg.embed(embed);
|
||||
@@ -44,9 +45,4 @@ module.exports = class PokedexCommand extends Command {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
filter(arr) {
|
||||
const filtered = arr.filter(entry => entry.language.name === 'en');
|
||||
return filtered[Math.floor(Math.random() * filtered.length)];
|
||||
}
|
||||
};
|
||||
|
||||
@@ -45,6 +45,7 @@ module.exports = class RedditCommand extends Command {
|
||||
post.data.score, true);
|
||||
return msg.embed(embed);
|
||||
} catch (err) {
|
||||
if (err.status === 403) return msg.say('This Subreddit is Private.');
|
||||
if (err.status === 404) return msg.say('Subreddit Not Found.');
|
||||
throw err;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user