snekfetch 4.0.0

This commit is contained in:
Daniel Odendahl Jr
2018-02-26 22:10:01 +00:00
parent a4767134e5
commit 9aaf21913b
22 changed files with 45 additions and 40 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!`);
}
}