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
+3 -3
View File
@@ -20,10 +20,10 @@ module.exports = class NumberFactCommand extends Command {
async run(msg, { number }) {
try {
const { text } = await snekfetch.get(`http://numbersapi.com/${number}`);
return msg.say(text);
const { raw } = await snekfetch.get(`http://numbersapi.com/${number}`);
return msg.say(raw.toString());
} catch (err) {
if (err.status === 404) return msg.say('Could not find any results.');
if (err.statusCode === 404) return msg.say('Could not find any results.');
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
+2 -2
View File
@@ -37,8 +37,8 @@ module.exports = class RedditCommand extends Command {
${post.downs}
`);
} catch (err) {
if (err.status === 403) return msg.say('This subreddit is private.');
if (err.status === 404) return msg.say('Could not find any results.');
if (err.statusCode === 403) return msg.say('This subreddit is private.');
if (err.statusCode === 404) return msg.say('Could not find any results.');
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}