mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-26 06:42:50 +02:00
Beep
This commit is contained in:
@@ -34,6 +34,7 @@ module.exports = class SafebooruCommand extends Command {
|
|||||||
const parsed = xml2js(text, { compact: true }).posts;
|
const parsed = xml2js(text, { compact: true }).posts;
|
||||||
if (parsed._attributes.count === '0' || !parsed.post.length) return msg.say('Could not find any results.');
|
if (parsed._attributes.count === '0' || !parsed.post.length) return msg.say('Could not find any results.');
|
||||||
const posts = msg.channel.nsfw ? parsed.post : parsed.post.filter(post => post._attributes.rating === 's');
|
const posts = msg.channel.nsfw ? parsed.post : parsed.post.filter(post => post._attributes.rating === 's');
|
||||||
|
if (!posts.length) return msg.say('Could not find any results.');
|
||||||
return msg.say(stripIndents`
|
return msg.say(stripIndents`
|
||||||
${query ? `Results for ${query}:` : 'Random Image:'}
|
${query ? `Results for ${query}:` : 'Random Image:'}
|
||||||
https:${posts[Math.floor(Math.random() * posts.length)]._attributes.file_url}
|
https:${posts[Math.floor(Math.random() * posts.length)]._attributes.file_url}
|
||||||
|
|||||||
Reference in New Issue
Block a user