From c6d45a94b0e3bbcb0b2e01ed8e35428040126c45 Mon Sep 17 00:00:00 2001 From: 8cy <50817549+8cy@users.noreply.github.com> Date: Tue, 28 Apr 2020 13:16:40 -0700 Subject: 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 --- src/commands/nsfw/rule34.ts | 58 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/commands/nsfw/rule34.ts (limited to 'src/commands/nsfw/rule34.ts') 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 -- cgit v1.2.3