Lots of stoof

This commit is contained in:
Daniel Odendahl Jr
2017-10-12 02:15:40 +00:00
parent 04c1728591
commit b15beb8d48
7 changed files with 30 additions and 14 deletions
+8 -2
View File
@@ -1,4 +1,5 @@
const { Command } = require('discord.js-commando');
const snekfetch = require('snekfetch');
const pokemon = require('../../assets/json/pokemon-fusion');
module.exports = class PokemonFusionCommand extends Command {
@@ -35,7 +36,12 @@ module.exports = class PokemonFusionCommand extends Command {
});
}
run(msg, { body, palette }) {
return msg.say({ files: [`http://images.alexonsager.net/pokemon/fused/${body}/${body}.${palette}.png`] });
async run(msg, { body, palette }) {
try {
const image = await snekfetch.get(`http://images.alexonsager.net/pokemon/fused/${body}/${body}.${palette}.png`);
return msg.say({ files: [{ attachment: image.body, name: 'pokemon-fusion.png' }] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};