Nevermind, they're actually smart

This commit is contained in:
Daniel Odendahl Jr
2018-04-11 01:16:11 +00:00
parent 3d250f65dd
commit 5c1d5f33c2
+2 -2
View File
@@ -35,10 +35,10 @@ module.exports = class ShieldsIoBadgeCommand extends Command {
async run(msg, { subject, status, color }) {
try {
const { body, headers } = await snekfetch.get(`https://img.shields.io/badge/${subject}-${status}-${color}.png`);
if (headers['content-type'] !== 'image/png') return msg.reply('Could not create the badge...');
const { body } = await snekfetch.get(`https://img.shields.io/badge/${subject}-${status}-${color}.png`);
return msg.say({ files: [{ attachment: body, name: 'badge.png' }] });
} catch (err) {
if (err.status === 404) return msg.reply('Could not create the badge...');
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}