This commit is contained in:
Daniel Odendahl Jr
2017-10-11 17:16:30 +00:00
parent 720021ae77
commit cbfe26a384
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -38,7 +38,7 @@ module.exports = class HistoryCommand extends Command {
event.links.map(link => `[${link.title}](${link.link.replace(/\)/g, '%29')})`).join(', '));
return msg.embed(embed);
} catch (err) {
if (err.status === 404) return msg.say('Could not find any results.');
if (err.status === 404 || err.status === 500) return msg.say('Could not find any results.');
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
+1 -1
View File
@@ -32,7 +32,7 @@ module.exports = class SafebooruCommand extends Command {
tags: query
});
const parsed = xml2js(text, { compact: true }).posts;
if (!parsed.post.length) return msg.say('Could not find any results.');
if (!parsed.post || !parsed.post.length) return msg.say('Could not find any results.');
return msg.say(stripIndents`
Result for ${query}:
http:${parsed.post[Math.floor(Math.random() * parsed.post.length)]._attributes.file_url}