diff options
| author | 8cy <[email protected]> | 2020-04-28 13:16:40 -0700 |
|---|---|---|
| committer | 8cy <[email protected]> | 2020-04-28 13:16:40 -0700 |
| commit | c6d45a94b0e3bbcb0b2e01ed8e35428040126c45 (patch) | |
| tree | 526227612501768272e1f985d5f7c6b3671bf638 /src/commands/nsfw | |
| parent | change darling quote calc method, add 002 quotes to quote, v8.1.2 (diff) | |
| download | dep-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')
| -rw-r--r-- | src/commands/nsfw/danbooru.ts | 69 | ||||
| -rw-r--r-- | src/commands/nsfw/gelbooru.ts | 69 | ||||
| -rw-r--r-- | src/commands/nsfw/rule34.ts | 58 |
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 |