mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-26 06:42:50 +02:00
Switch Things to Linking
This commit is contained in:
@@ -10,7 +10,6 @@ module.exports = class Rule34Command extends Command {
|
||||
group: 'search',
|
||||
memberName: 'rule34',
|
||||
description: 'Sends an image from Rule34, with query.',
|
||||
guildOnly: true,
|
||||
args: [
|
||||
{
|
||||
key: 'query',
|
||||
@@ -23,8 +22,6 @@ module.exports = class Rule34Command extends Command {
|
||||
|
||||
async run(msg, args) {
|
||||
if (!msg.channel.nsfw) return msg.say('This Command can only be used in NSFW Channels.');
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
||||
return msg.say('This Command requires the `Attach Files` Permission.');
|
||||
const { query } = args;
|
||||
try {
|
||||
const { text } = await snekfetch
|
||||
@@ -38,8 +35,7 @@ module.exports = class Rule34Command extends Command {
|
||||
});
|
||||
const { posts } = await xml(text);
|
||||
if (posts.$.count === '0') throw new Error('No Results.');
|
||||
return msg.say(`Result for ${query}:`, { files: [`https:${posts.post[0].$.file_url}`] })
|
||||
.catch(err => msg.say(`${err.name}: ${err.message}`));
|
||||
return msg.say(`Result for ${query}: https:${posts.post[0].$.file_url}`);
|
||||
} catch (err) {
|
||||
return msg.say(`${err.name}: ${err.message}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user