Switch Things to Linking

This commit is contained in:
Daniel Odendahl Jr
2017-05-25 23:20:58 +00:00
parent 26a94a9619
commit fba5f67b48
8 changed files with 8 additions and 36 deletions
+1 -5
View File
@@ -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}`);
}