summaryrefslogtreecommitdiff
path: root/src/commands/nsfw/rule34.ts
diff options
context:
space:
mode:
author8cy <[email protected]>2020-04-28 13:16:40 -0700
committer8cy <[email protected]>2020-04-28 13:16:40 -0700
commitc6d45a94b0e3bbcb0b2e01ed8e35428040126c45 (patch)
tree526227612501768272e1f985d5f7c6b3671bf638 /src/commands/nsfw/rule34.ts
parentchange darling quote calc method, add 002 quotes to quote, v8.1.2 (diff)
downloaddep-core-c6d45a94b0e3bbcb0b2e01ed8e35428040126c45.tar.xz
dep-core-c6d45a94b0e3bbcb0b2e01ed8e35428040126c45.zip
The Return, v8.2.0
- add goodbye - add avatar alias to pfp - add rule34, gelbooru and danbooru - fix ban and kick - add advice - add motivation alias to motivate
Diffstat (limited to 'src/commands/nsfw/rule34.ts')
-rw-r--r--src/commands/nsfw/rule34.ts58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/commands/nsfw/rule34.ts b/src/commands/nsfw/rule34.ts
new file mode 100644
index 0000000..eb6fa10
--- /dev/null
+++ b/src/commands/nsfw/rule34.ts
@@ -0,0 +1,58 @@
+import { Command, CommandoMessage } from 'discord.js-commando';
+import { MessageEmbed } from 'discord.js';
+import axios from 'axios'
+
+export default class Rule34Bot extends Command {
+ constructor(client) {
+ super(client, {
+ name: 'rule34',
+ aliases: ['r34'],
+ group: 'nsfw',
+ memberName: 'rule34',
+ description: 'Rule34.',
+ throttling: {
+ usages: 5,
+ duration: 30
+ },
+ examples: [
+ 'uwu!rule34',
+ 'uwu!rule34 minecraft'
+ ],
+ userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'],
+ clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'],
+ args: [
+ {
+ key: 'tags',
+ prompt: 'What tag(s) would you like?',
+ type: 'string'
+ }
+ ],
+ nsfw: true
+ });
+ }
+ async run(msg: CommandoMessage, { tags }) {
+ let randomInt = Math.floor(Math.random() * 100)
+ let blacklist = ['loli', 'shota', 'cub', 'young', 'child', 'baby', 'guro', 'gore', 'vore', 'scat'];
+
+ if (tags !== 0) {
+ if (blacklist.includes(tags)) {
+ msg.reply('Blacklisted word was used! ⛔')
+ }
+ }
+
+ let res = await axios.get(`http://rule34.xxx/index.php?page=dapi&s=post&q=index&limit=100&tags=${tags}+-rating:safe&json=1`)
+
+ if (blacklist.includes(res.data[randomInt].tags)) {
+ msg.reply('Sorry! This image had a tag that was blacklisted! ⛔')
+ }
+
+ let emb = new MessageEmbed()
+ .setColor(0xFFCC4D)
+ .setTitle(`Rule34 - ${!tags ? 'Random Image' : tags}`)
+ .setDescription(`[Source](https://rule34.xxx/index.php?page=post&s=view&id=${res.data[randomInt].id})`)
+ .setImage(`https://rule34.xxx/images/${res.data[randomInt].directory}/${res.data[randomInt].image}`)
+ .setTimestamp(new Date())
+ .setFooter(`Score: ${res.data[randomInt].score} | Rating: ${res.data[randomInt].rating}`, msg.author.avatarURL())
+ msg.say(emb);
+ }
+} \ No newline at end of file