diff options
| author | 8cy <[email protected]> | 2020-07-23 23:24:17 -0700 |
|---|---|---|
| committer | 8cy <[email protected]> | 2020-07-23 23:24:17 -0700 |
| commit | bb511abc03bb66848947e37a999502b813c77269 (patch) | |
| tree | 612c010fc8317e1cdf11471a18aad0270819d33e /src/commands/nsfw | |
| parent | fix: if clear amount equal or over 100, round down to 99 (diff) | |
| download | dep-core-bb511abc03bb66848947e37a999502b813c77269.tar.xz dep-core-bb511abc03bb66848947e37a999502b813c77269.zip | |
goodbye old uwufier :cry:
Diffstat (limited to 'src/commands/nsfw')
| -rw-r--r-- | src/commands/nsfw/danbooru.ts | 80 | ||||
| -rw-r--r-- | src/commands/nsfw/gelbooru.ts | 80 | ||||
| -rw-r--r-- | src/commands/nsfw/rule34.ts | 67 |
3 files changed, 0 insertions, 227 deletions
diff --git a/src/commands/nsfw/danbooru.ts b/src/commands/nsfw/danbooru.ts deleted file mode 100644 index 065c01b..0000000 --- a/src/commands/nsfw/danbooru.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; -import axios from 'axios' - -export default class DanbooruNSFW extends Command { - constructor(client: CommandoClient) { - 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: 'tTags', - prompt: 'What tag(s) would you like?', - type: 'string', - default: '' - } - ], - nsfw: true - }); - } - async run(msg: CommandoMessage, { tTags }: any) { - const tags = await tTags.trim().toLowerCase() - console.log(tags) - const blacklist = ['loli', 'shota', 'cub', 'young', 'child', 'baby', 'guro', 'gore', 'vore', 'scat', 'poop', 'kid', 'shit', 'turd', 'feces', 'excrement', 'excrete']; - - if (tags) { - if (blacklist.includes(tags)) { - return msg.reply('Blacklisted word was used! ⛔') - } - } - - const res = await axios.get(`https://danbooru.donmai.us/posts.json?limit=200&tags=${tags}+-rating:safe`) - .catch(error => console.log(error)) - - //@ts-ignore yes data exists - const randomInt = Math.floor(Math.random() * res.data.length) - - //@ts-ignore yes data exists - if (blacklist.includes(res.data[randomInt].tags)) { - return msg.reply('Sorry! This image had a tag that was blacklisted! ⛔') - } - - //@ts-ignore yes all code paths return a value - let getRating = (rating: any) => { - 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}`) - //@ts-ignore yes data exists - .setDescription(`[Source](http://danbooru.donmai.us/posts/${res.data[randomInt].id})\n\nFixed bug where responses were being evaluated out of 100 instead of data length!`) - //@ts-ignore yes data exists - .setImage(res.data[randomInt].file_url) - .setTimestamp(new Date()) - //@ts-ignore yes data exists - .setFooter(`Score: ${res.data[randomInt].score} | Rating: ${getRating(res.data[randomInt].rating)}`, msg.author.avatarURL()) - return msg.say(emb); - } -}
\ No newline at end of file diff --git a/src/commands/nsfw/gelbooru.ts b/src/commands/nsfw/gelbooru.ts deleted file mode 100644 index a9890fa..0000000 --- a/src/commands/nsfw/gelbooru.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; -import axios from 'axios' - -export default class GelbooruNSFW extends Command { - constructor(client: CommandoClient) { - 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: 'tTags', - prompt: 'What tag(s) would you like?', - type: 'string', - default: '' - } - ], - nsfw: true - }); - } - async run(msg: CommandoMessage, { tTags }: any) { - const tags = await tTags.trim() - const blacklist = ['loli', 'shota', 'cub', 'young', 'child', 'baby', 'guro', 'gore', 'vore', 'scat', 'poop', 'kid', 'shit', 'turd', 'feces', 'excrement', 'excrete']; - - if (tags) { - if (blacklist.includes(tags.toLowerCase())) { - return msg.reply('Blacklisted word was used! ⛔') - } - } - - const res = await axios.get(`https://gelbooru.com/index.php?page=dapi&s=post&q=index&limit=100&tags=${tags}+-rating:safe&json=1`) - .catch(error => console.log(error)) - - //@ts-ignore yes data exists - const randomInt = Math.floor(Math.random() * res.data.length) - - //@ts-ignore yes data exists - if (blacklist.includes(res.data[randomInt].tags.toLowerCase())) { - return msg.reply('Sorry! This image had a tag that was blacklisted! ⛔') - } - - - //@ts-ignore yes all code paths return a value - let getRating = (rating: any) => { - 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}`) - //@ts-ignore yes data exists - .setDescription(`[Source](https://gelbooru.com/index.php?page=post&s=view&id=${res.data[randomInt].id})\n\nFixed bug where responses were being evaluated out of 100 instead of data length!`) - //@ts-ignore yes data exists - .setImage(res.data[randomInt].file_url) - .setTimestamp(new Date()) - //@ts-ignore yes data exists - .setFooter(`Score: ${res.data[randomInt].score} | Rating: ${getRating(res.data[randomInt].rating)}`, msg.author.avatarURL()) - return msg.say(emb); - } -}
\ No newline at end of file diff --git a/src/commands/nsfw/rule34.ts b/src/commands/nsfw/rule34.ts deleted file mode 100644 index 568b07a..0000000 --- a/src/commands/nsfw/rule34.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; -import axios from 'axios' - -export default class Rule34NSFW extends Command { - constructor(client: CommandoClient) { - 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: 'tTags', - prompt: 'What tag(s) would you like?', - type: 'string', - default: '' - } - ], - nsfw: true - }); - } - async run(msg: CommandoMessage, { tTags }: any) { - const tags = await tTags.trim() - const blacklist = ['loli', 'shota', 'cub', 'young', 'child', 'baby', 'guro', 'gore', 'vore', 'scat', 'poop', 'kid', 'shit', 'turd', 'feces', 'excrement', 'excrete']; - - if (tags) { - if (blacklist.includes(tags.toLowerCase())) { - return msg.reply('Blacklisted word was used! ⛔') - } - } - - const res = await axios.get(`http://rule34.xxx/index.php?page=dapi&s=post&q=index&limit=100&tags=${tags}+-rating:safe&json=1`) - .catch(error => console.log(error)) - - //@ts-ignore yes data exists - const randomInt = Math.floor(Math.random() * res.data.length) - - //@ts-ignore yes data exists - if (blacklist.includes(res.data[randomInt].tags.toLowerCase())) { - return msg.reply('Sorry! This image had a tag that was blacklisted! ⛔') - } - - let emb = new MessageEmbed() - .setColor(0xFFCC4D) - .setTitle(`Rule34 - ${!tags ? 'Random Image' : tags}`) - //@ts-ignore yes data exists - .setDescription(`[Source](https://rule34.xxx/index.php?page=post&s=view&id=${res.data[randomInt].id})\n\nFixed bug where responses were being evaluated out of 100 instead of data length!`) - //@ts-ignore yes data exists - .setImage(`https://rule34.xxx/images/${res.data[randomInt].directory}/${res.data[randomInt].image}`) - .setTimestamp(new Date()) - //@ts-ignore yes data exists - .setFooter(`Score: ${res.data[randomInt].score} | Rating: ${res.data[randomInt].rating}`, msg.author.avatarURL()) - return msg.say(emb); - } -}
\ No newline at end of file |