mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-27 14:18:36 +02:00
Merge branch 'master' of https://bitbucket.org/dragonfire535/xiaobot
This commit is contained in:
@@ -36,6 +36,6 @@ module.exports = class PokemonFusionCommand extends Command {
|
|||||||
|
|
||||||
run(msg, args) {
|
run(msg, args) {
|
||||||
const { source1, source2 } = args;
|
const { source1, source2 } = args;
|
||||||
return msg.say(`http://images.alexonsager.net/pokemon/fused/${source1}/${source1}.${source2}.png`);
|
return msg.say({ files: [`http://images.alexonsager.net/pokemon/fused/${source1}/${source1}.${source2}.png`] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
const Command = require('../../structures/Command');
|
||||||
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
const snekfetch = require('snekfetch');
|
||||||
|
const { stripIndents } = require('common-tags');
|
||||||
|
|
||||||
|
module.exports = class PokedexCommand extends Command {
|
||||||
|
constructor(client) {
|
||||||
|
super(client, {
|
||||||
|
name: 'pokedex',
|
||||||
|
aliases: ['pokemon', 'pokémon', 'pokédex'],
|
||||||
|
group: 'search',
|
||||||
|
memberName: 'pokedex',
|
||||||
|
description: 'Searches the Pokédex for a Pokémon.',
|
||||||
|
clientPermissions: ['EMBED_LINKS'],
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
key: 'pokemon',
|
||||||
|
prompt: 'What Pokémon would you like to search for?',
|
||||||
|
type: 'string',
|
||||||
|
parse: (pokemon) => pokemon.toLowerCase().replace(/[ ]/g, '-')
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(msg, args) {
|
||||||
|
const { pokemon } = args;
|
||||||
|
try {
|
||||||
|
const { body } = await snekfetch
|
||||||
|
.get(`https://pokeapi.co/api/v2/pokemon-species/${pokemon}`);
|
||||||
|
const id = `${'000'.slice(body.id.toString().length)}${body.id}`;
|
||||||
|
const name = this.filter(body.names).name;
|
||||||
|
const flavor = this.filter(body.flavor_text_entries).flavor_text;
|
||||||
|
const species = this.filter(body.genera).genus;
|
||||||
|
const embed = new MessageEmbed()
|
||||||
|
.setColor(0xED1C24)
|
||||||
|
.setAuthor(`#${id} - ${name}`, `https://www.serebii.net/pokedex-sm/icon/${id}.png`)
|
||||||
|
.setURL(`https://www.serebii.net/pokedex-sm/${id}.shtml`)
|
||||||
|
.setDescription(stripIndents`
|
||||||
|
**The ${species} Pokémon**
|
||||||
|
${flavor}
|
||||||
|
`)
|
||||||
|
.setThumbnail(`https://www.serebii.net/sunmoon/pokemon/${id}.png`);
|
||||||
|
return msg.embed(embed);
|
||||||
|
} catch (err) {
|
||||||
|
if (err.status === 404) return msg.say('Pokémon Not Found.');
|
||||||
|
else throw err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
filter(arr) {
|
||||||
|
return arr.filter((entry) => entry.language.name === 'en')[0];
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -20,6 +20,11 @@ module.exports = class AvatarCommand extends Command {
|
|||||||
|
|
||||||
run(msg, args) {
|
run(msg, args) {
|
||||||
const user = args.user || msg.author;
|
const user = args.user || msg.author;
|
||||||
return msg.say(user.displayAvatarURL({ size: 2048 }));
|
if (!user.avatar) return msg.say('This user has no avatar.');
|
||||||
|
const avatar = user.avatarURL({
|
||||||
|
format: user.avatar.startsWith('a_') ? 'gif' : 'png',
|
||||||
|
size: 2048
|
||||||
|
});
|
||||||
|
return msg.say(avatar);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -49,6 +49,7 @@
|
|||||||
<li>Neopets</li>
|
<li>Neopets</li>
|
||||||
<li>NPM</li>
|
<li>NPM</li>
|
||||||
<li>osu!</li>
|
<li>osu!</li>
|
||||||
|
<li>Pokédex</li>
|
||||||
<li>Recipe Puppy</li>
|
<li>Recipe Puppy</li>
|
||||||
<li>Reddit</li>
|
<li>Reddit</li>
|
||||||
<li>Rule34</li>
|
<li>Rule34</li>
|
||||||
|
|||||||
@@ -46,6 +46,7 @@
|
|||||||
<li>Neopets</li>
|
<li>Neopets</li>
|
||||||
<li>NPM</li>
|
<li>NPM</li>
|
||||||
<li>osu!</li>
|
<li>osu!</li>
|
||||||
|
<li>Pokédex</li>
|
||||||
<li>Recipe Puppy</li>
|
<li>Recipe Puppy</li>
|
||||||
<li>Reddit</li>
|
<li>Reddit</li>
|
||||||
<li>Rule34</li>
|
<li>Rule34</li>
|
||||||
|
|||||||
Reference in New Issue
Block a user