diff --git a/commands/random-res/history.js b/commands/random-res/history.js index 5ae95b39..a1152a1d 100644 --- a/commands/random-res/history.js +++ b/commands/random-res/history.js @@ -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!`); } } diff --git a/commands/search/safebooru.js b/commands/search/safebooru.js index f9fc75a6..8af26bbb 100644 --- a/commands/search/safebooru.js +++ b/commands/search/safebooru.js @@ -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}