Split Some Commands Up

This commit is contained in:
Daniel Odendahl Jr
2017-05-09 00:23:56 +00:00
parent 51b03fc2b1
commit 6092e9e09d
7 changed files with 38 additions and 7 deletions
@@ -1,13 +1,13 @@
const { Command } = require('discord.js-commando');
const request = require('superagent');
module.exports = class NSFWAnimeCommand extends Command {
module.exports = class KonachanCommand extends Command {
constructor(client) {
super(client, {
name: 'nsfw-anime',
name: 'konachan',
group: 'randomimg',
memberName: 'nsfw-anime',
description: 'Sends a random (NSFW!) anime image.',
memberName: 'konachan',
description: 'Sends a random (Possibly NSFW!) anime image from Konachan.',
guildOnly: true
});
}
+28
View File
@@ -0,0 +1,28 @@
const { Command } = require('discord.js-commando');
const request = require('superagent');
module.exports = class LolibooruCommand extends Command {
constructor(client) {
super(client, {
name: 'lolibooru',
group: 'randomimg',
memberName: 'lolibooru',
description: 'Sends a random (Possibly NSFW!) anime image from Lolibooru.',
guildOnly: true
});
}
async run(msg) {
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.');
try {
const { body } = await request
.get('https://lolibooru.moe/post/index.json?tags=order:random&limit=1');
return msg.channel.send({ files: [`https:${body[0].file_url}`] })
.catch(err => msg.say(err));
} catch (err) {
return msg.say(err);
}
}
};
+2 -1
View File
@@ -83,7 +83,8 @@ module.exports = class InfoCommand extends Command {
[random.cat](http://random.cat),
[random.dog](https://random.dog),
[fixer.io](http://fixer.io),
[konachan](https://konachan.net)
[konachan](https://konachan.net),
[lolibooru](https://lolibooru.moe)
`
);
return msg.embed(embed);