snekfetch 4.0.0

This commit is contained in:
Daniel Odendahl Jr
2018-04-24 21:27:16 +00:00
parent 6030c024c1
commit d26af498ad
27 changed files with 56 additions and 49 deletions
+2 -2
View File
@@ -35,7 +35,7 @@ module.exports = class OsuSignatureCommand extends Command {
async run(msg, { user, color }) {
try {
const { body, text } = await snekfetch
const { body, raw } = await snekfetch
.get('https://lemmmy.pw/osusig/sig.php')
.query({
colour: color,
@@ -48,7 +48,7 @@ module.exports = class OsuSignatureCommand extends Command {
onlineindicator: '',
xpbar: ''
});
if (text.includes('<b>Warning</b>')) return msg.say('Could not find any results.');
if (raw.toString().includes('<b>Warning</b>')) return msg.say('Could not find any results.');
return msg.say({ files: [{ attachment: body, name: 'osu-signature.png' }] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
+1 -1
View File
@@ -38,7 +38,7 @@ module.exports = class ShieldsIoBadgeCommand extends Command {
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...');
if (err.statusCode === 404) return msg.reply('Could not create the badge...');
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}