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/gelbooru.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/gelbooru.ts')
| -rw-r--r-- | src/commands/nsfw/gelbooru.ts | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/commands/nsfw/gelbooru.ts b/src/commands/nsfw/gelbooru.ts index cd2ca1d..44c0ccc 100644 --- a/src/commands/nsfw/gelbooru.ts +++ b/src/commands/nsfw/gelbooru.ts @@ -21,25 +21,29 @@ export default class GelbooruNSFW 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() + const blacklist = ['loli', 'shota', 'cub', 'young', 'child', 'baby', 'guro', 'gore', 'vore', 'scat', 'poop', 'kid', 'shit', 'turd', 'feces', 'excrement', 'excrete']; - if (tags !== 0) { + if (tags) { if (blacklist.includes(tags.toLowerCase())) { return 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`) + 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)) + + const randomInt = Math.floor(Math.random() * res.data.length) if (blacklist.includes(res.data[randomInt].tags.toLowerCase())) { return msg.reply('Sorry! This image had a tag that was blacklisted! ⛔') @@ -60,7 +64,7 @@ export default class GelbooruNSFW extends Command { 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})`) + .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!`) .setImage(res.data[randomInt].file_url) .setTimestamp(new Date()) .setFooter(`Score: ${res.data[randomInt].score} | Rating: ${getRating(res.data[randomInt].rating)}`, msg.author.avatarURL()) |