summaryrefslogtreecommitdiff
path: root/src/commands/nsfw
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/nsfw')
-rw-r--r--src/commands/nsfw/danbooru.ts69
-rw-r--r--src/commands/nsfw/gelbooru.ts69
-rw-r--r--src/commands/nsfw/rule34.ts58
3 files changed, 196 insertions, 0 deletions
diff --git a/src/commands/nsfw/danbooru.ts b/src/commands/nsfw/danbooru.ts
new file mode 100644
index 0000000..87df99e
--- /dev/null
+++ b/src/commands/nsfw/danbooru.ts
@@ -0,0 +1,69 @@
+import { Command, CommandoMessage } from 'discord.js-commando';
+import { MessageEmbed } from 'discord.js';
+import axios from 'axios'
+
+export default class DanbooruBot extends Command {
+ constructor(client) {
+ super(client, {
+ name: 'danbooru',
+ group: 'nsfw',
+ memberName: 'danbooru',
+ description: 'Danbooru.',
+ throttling: {
+ usages: 5,
+ duration: 30
+ },
+ examples: [
+ 'uwu!danbooru',
+ 'uwu!danbooru 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(`https://danbooru.donmai.us/posts.json?limit=200&tags=${tags}+-rating:safe`)
+
+ if (blacklist.includes(res.data[randomInt].tags)) {
+ msg.reply('Sorry! This image had a tag that was blacklisted! ⛔')
+ }
+
+ let getRating = (rating) => {
+ if (rating === 's') {
+ return 'Safe'
+ } if (rating === 'q') {
+ return 'Questionable'
+ } if (rating === 'e') {
+ return 'Explicit'
+ } if (rating === 'u') {
+ return 'Unrated'
+ }
+ }
+
+ let emb = new MessageEmbed()
+ .setColor(0xFFCC4D)
+ .setTitle(`Danbooru - ${!tags ? 'Random Image' : tags}`)
+ .setDescription(`[Source](http://danbooru.donmai.us/posts/${res.data[randomInt].id})`)
+ .setImage(res.data[randomInt].file_url)
+ .setTimestamp(new Date())
+ .setFooter(`Score: ${res.data[randomInt].score} | Rating: ${getRating(res.data[randomInt].rating)}`, msg.author.avatarURL())
+ msg.say(emb);
+ }
+} \ No newline at end of file
diff --git a/src/commands/nsfw/gelbooru.ts b/src/commands/nsfw/gelbooru.ts
new file mode 100644
index 0000000..2f6fdeb
--- /dev/null
+++ b/src/commands/nsfw/gelbooru.ts
@@ -0,0 +1,69 @@
+import { Command, CommandoMessage } from 'discord.js-commando';
+import { MessageEmbed } from 'discord.js';
+import axios from 'axios'
+
+export default class GelbooruBot extends Command {
+ constructor(client) {
+ super(client, {
+ name: 'gelbooru',
+ group: 'nsfw',
+ memberName: 'gelbooru',
+ description: 'Gelbooru.',
+ throttling: {
+ usages: 5,
+ duration: 30
+ },
+ examples: [
+ 'uwu!gelbooru',
+ 'uwu!gelbooru 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(`https://gelbooru.com/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 getRating = (rating) => {
+ if (rating === 's') {
+ return 'Safe'
+ } if (rating === 'q') {
+ return 'Questionable'
+ } if (rating === 'e') {
+ return 'Explicit'
+ } if (rating === 'u') {
+ return 'Unrated'
+ }
+ }
+
+ let emb = new MessageEmbed()
+ .setColor(0xFFCC4D)
+ .setTitle(`Gelbooru - ${!tags ? 'Random Image' : tags}`)
+ .setDescription(`[Source](https://gelbooru.com/index.php?page=post&s=view&id=${res.data[randomInt].id})`)
+ .setImage(res.data[randomInt].file_url)
+ .setTimestamp(new Date())
+ .setFooter(`Score: ${res.data[randomInt].score} | Rating: ${getRating(res.data[randomInt].rating)}`, msg.author.avatarURL())
+ msg.say(emb);
+ }
+} \ No newline at end of file
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