summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author8cy <[email protected]>2020-05-13 02:25:29 -0700
committer8cy <[email protected]>2020-05-13 02:25:29 -0700
commitd0f7ec18c1b8284917b33c542d9e249ec958f213 (patch)
tree65f36a62067be59c0b24efda732b307b8291aef5
parentupdate formatting for support and joinmsg (diff)
downloaddep-core-d0f7ec18c1b8284917b33c542d9e249ec958f213.tar.xz
dep-core-d0f7ec18c1b8284917b33c542d9e249ec958f213.zip
fix nsfw cmds, add rockpaperscissors
-rw-r--r--package.json2
-rw-r--r--src/commands/fun/rockpaperscissors.ts80
-rw-r--r--src/commands/nsfw/danbooru.ts25
-rw-r--r--src/commands/nsfw/gelbooru.ts20
-rw-r--r--src/commands/nsfw/rule34.ts19
-rw-r--r--src/config.json2
6 files changed, 120 insertions, 28 deletions
diff --git a/package.json b/package.json
index dc1b934..e85cf86 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "uwufier",
- "version": "1.10.12",
+ "version": "1.10.13",
"description": "A Discord bot that supports audio playback, fun commands, utilities, and soundsboard, and more to come!",
"main": "./dist/app.js",
"scripts": {
diff --git a/src/commands/fun/rockpaperscissors.ts b/src/commands/fun/rockpaperscissors.ts
new file mode 100644
index 0000000..422481f
--- /dev/null
+++ b/src/commands/fun/rockpaperscissors.ts
@@ -0,0 +1,80 @@
+import { Command, CommandoMessage } from 'discord.js-commando';
+import { MessageEmbed } from 'discord.js';
+
+module.exports = class RockPaperScissorsFun extends Command {
+ constructor(client) {
+ super(client, {
+ name: 'rockpaperscissors',
+ aliases: ['rps'],
+ group: 'fun',
+ memberName: 'rockpaperscissors',
+ description: '**[Disabled]** Play Rock, Paper Scissors.',
+ throttling: {
+ usages: 5,
+ duration: 30
+ },
+ examples: ['uwu!rockpaperscissors', 'uwu!rps'],
+ userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'],
+ clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY']
+ });
+ }
+ async run(msg: CommandoMessage) {
+ // TODO: fix this
+ msg.reply('Command disabled.')
+
+ // const rock = '๐Ÿ’Ž'
+ // const paper = '๐Ÿงป'
+ // const scissors = 'โœ‚๏ธ'
+
+ // let embed = new MessageEmbed()
+ // .setAuthor(msg.author.tag, msg.author.displayAvatarURL())
+ // .setDescription('What would you like to choose?')
+ // .setColor(0xFFCC4D)
+ // .setTimestamp()
+
+ // const m = await msg.channel.send(embed)
+
+ // const react1 = await m.react(rock)
+ // const react2 = await m.react(paper)
+ // const react3 = await m.react(scissors)
+
+ // const chooseArr = [rock, paper, scissors]
+
+ // const randChoice = await chooseArr[Math.floor(Math.random() * chooseArr.length)]
+
+ // let collector = await m.createReactionCollector((reacted, user) => user.id === msg.author.id)
+
+ // collector.on('collect', async (reaction, user) => {
+ // let winEmb = new MessageEmbed()
+ // .setAuthor(msg.author.tag, msg.author.displayAvatarURL())
+ // .setDescription('You won!')
+ // .addField('Results:', `${reaction.emoji} vs ${randChoice}`)
+ // .setColor('GREEN')
+ // .setTimestamp()
+
+ // let tieEmb = new MessageEmbed()
+ // .setAuthor(msg.author.tag, msg.author.displayAvatarURL())
+ // .setDescription('You tied!')
+ // .addField('Results:', `${reaction.emoji} vs ${randChoice}`)
+ // .setColor(0xFFCC4D)
+ // .setTimestamp()
+
+ // let lostEmb = new MessageEmbed()
+ // .setAuthor(msg.author.tag, msg.author.displayAvatarURL())
+ // .setDescription('You lost!')
+ // .addField('Results:', `${reaction.emoji} vs ${randChoice}`)
+ // .setColor('RED')
+ // .setTimestamp()
+ // if ((reaction.emoji === rock && randChoice === scissors) || (reaction.emoji === paper && randChoice === rock) || (reaction.emoji === scissors && randChoice === paper)) {
+ // m.delete()
+ // msg.channel.send(winEmb)
+ // } else if (reaction.emoji === randChoice) {
+ // m.delete()
+ // msg.channel.send(tieEmb)
+ // } else {
+ // m.delete()
+ // msg.channel.send(lostEmb)
+ // }
+ // })
+ }
+}; \ No newline at end of file
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())
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())
diff --git a/src/commands/nsfw/rule34.ts b/src/commands/nsfw/rule34.ts
index 2080d93..0e453cf 100644
--- a/src/commands/nsfw/rule34.ts
+++ b/src/commands/nsfw/rule34.ts
@@ -22,26 +22,29 @@ export default class Rule34NSFW extends Command {
clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'],
args: [
{
- key: 'tags',
+ key: 'tTags',
prompt: 'What tag(s) would you like?',
type: 'string',
- default: '',
+ 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! โ›”')
}
}
+
+ 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))
- let res = await axios.get(`http://rule34.xxx/index.php?page=dapi&s=post&q=index&limit=100&tags=${tags}+-rating:safe&json=1`)
+ 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! โ›”')
@@ -50,7 +53,7 @@ export default class Rule34NSFW extends Command {
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})`)
+ .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!`)
.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())
diff --git a/src/config.json b/src/config.json
index 1484d42..d1b9638 100644
--- a/src/config.json
+++ b/src/config.json
@@ -1,7 +1,7 @@
{
"secret":"Njk5NDczMjYzOTk4MjcxNDg5.XpU5oQ.btZuxVudhNllSQY6CxrXXtMJm9A",
"yt-api-key":"AIzaSyCeG1lQAeInv4vjFv_eTL9IFAFNdQC9Nk8",
- "version":"1.10.12",
+ "version":"1.10.13",
"fortniteTrackerNetworkToken": "4cf21f95-5f1a-412a-b4a7-e5424adc314a",
"maxMultipler": 100,
"minMultipler": 1.01