mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-24 22:34:46 +02:00
Add tags to sakugabooru
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
const Command = require('../../structures/Command');
|
const Command = require('../../structures/Command');
|
||||||
const request = require('node-superfetch');
|
const request = require('node-superfetch');
|
||||||
|
const { stripIndents } = require('common-tags');
|
||||||
|
|
||||||
module.exports = class SakugabooruCommand extends Command {
|
module.exports = class SakugabooruCommand extends Command {
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
@@ -41,7 +42,11 @@ module.exports = class SakugabooruCommand extends Command {
|
|||||||
return post.file_url;
|
return post.file_url;
|
||||||
});
|
});
|
||||||
if (!posts.length) return msg.say('Could not find any results.');
|
if (!posts.length) return msg.say('Could not find any results.');
|
||||||
return msg.say(posts[Math.floor(Math.random() * posts.length)].file_url);
|
const post = posts[Math.floor(Math.random() * posts.length)];
|
||||||
|
return msg.say(stripIndents`
|
||||||
|
${post.tags}
|
||||||
|
${post.file_url}
|
||||||
|
`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user