diff options
| author | 8cy <[email protected]> | 2020-05-13 02:25:29 -0700 |
|---|---|---|
| committer | 8cy <[email protected]> | 2020-05-13 02:25:29 -0700 |
| commit | d0f7ec18c1b8284917b33c542d9e249ec958f213 (patch) | |
| tree | 65f36a62067be59c0b24efda732b307b8291aef5 /src/commands/nsfw/danbooru.ts | |
| parent | update formatting for support and joinmsg (diff) | |
| download | dep-core-d0f7ec18c1b8284917b33c542d9e249ec958f213.tar.xz dep-core-d0f7ec18c1b8284917b33c542d9e249ec958f213.zip | |
fix nsfw cmds, add rockpaperscissors
Diffstat (limited to 'src/commands/nsfw/danbooru.ts')
| -rw-r--r-- | src/commands/nsfw/danbooru.ts | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/commands/nsfw/danbooru.ts b/src/commands/nsfw/danbooru.ts index c3ba680..4ab5347 100644 --- a/src/commands/nsfw/danbooru.ts +++ b/src/commands/nsfw/danbooru.ts @@ -21,27 +21,32 @@ export default class DanbooruNSFW extends Command { clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], args: [ { - key: 'tags', + key: 'tTags', prompt: 'What tag(s) would you like?', - type: 'string' + type: 'string', + default: '' } ], 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', 'poop', 'kid', 'shit', 'turd', 'feces', 'excrement', 'excrete']; + async run(msg: CommandoMessage, { tTags }) { + 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 !== 0) { - if (blacklist.includes(tags.toLowerCase())) { + if (tags) { + if (blacklist.includes(tags)) { return msg.reply('Blacklisted word was used! ⛔') } } - let res = await axios.get(`https://danbooru.donmai.us/posts.json?limit=200&tags=${tags}+-rating:safe`) + const res = await axios.get(`https://danbooru.donmai.us/posts.json?limit=200&tags=${tags}+-rating:safe`) + .catch(error => console.log(error)) - if (blacklist.includes(res.data[randomInt].tags.toLowerCase())) { + const randomInt = Math.floor(Math.random() * res.data.length) + + if (blacklist.includes(res.data[randomInt].tags)) { return msg.reply('Sorry! This image had a tag that was blacklisted! ⛔') } @@ -60,7 +65,7 @@ export default class DanbooruNSFW extends Command { let emb = new MessageEmbed() .setColor(0xFFCC4D) .setTitle(`Danbooru - ${!tags ? 'Random Image' : tags}`) - .setDescription(`[Source](http://danbooru.donmai.us/posts/${res.data[randomInt].id})`) + .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!`) .setImage(res.data[randomInt].file_url) .setTimestamp(new Date()) .setFooter(`Score: ${res.data[randomInt].score} | Rating: ${getRating(res.data[randomInt].rating)}`, msg.author.avatarURL()) |