mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-17 16:19:12 +02:00
snekfetch 4.0.0
This commit is contained in:
@@ -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!`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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!`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user