summaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
author8cy <[email protected]>2020-07-16 21:21:38 -0700
committer8cy <[email protected]>2020-07-16 21:21:38 -0700
commit8c0d89ba7f9e983f35ab6576d798ae0384b6ebab (patch)
tree928d4afe56377ef7fc9b2cc67f7d76d9301b1e74 /src/commands
parentconvert water to lowercase (diff)
downloaddep-core-8c0d89ba7f9e983f35ab6576d798ae0384b6ebab.tar.xz
dep-core-8c0d89ba7f9e983f35ab6576d798ae0384b6ebab.zip
add more perms
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/fun/say.ts17
-rw-r--r--src/commands/server/poll.ts42
2 files changed, 37 insertions, 22 deletions
diff --git a/src/commands/fun/say.ts b/src/commands/fun/say.ts
index e10aff8..985307a 100644
--- a/src/commands/fun/say.ts
+++ b/src/commands/fun/say.ts
@@ -1,6 +1,7 @@
import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando';
//@ts-ignore
import * as emoji from 'emoji-random'
+import * as config from '../../config.json'
module.exports = class SayFun extends Command {
constructor(client: CommandoClient) {
@@ -25,12 +26,20 @@ module.exports = class SayFun extends Command {
clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY']
});
}
+ //@ts-ignore
run(msg: CommandoMessage, { say }: any) {
- if (msg.author.id == '217348698294714370' || msg.guild.member(msg.author.id)?.hasPermission('MANAGE_MESSAGES')) {
- msg.say(say)
- msg.delete();
+ if (config['validUsers'].includes(msg.author.id)) {
+ if (msg.author.id == '217348698294714370' || msg.guild.member(msg.author.id)?.hasPermission('MANAGE_MESSAGES')) {
+ msg.say(say)
+ msg.delete();
+ return
+ } else {
+ //@ts-ignore
+ return msg.reply(`Insufficent permissions! ${emoji.random()}`).then(m => m.delete({ timeout: 3000 }))
+ }
} else {
- msg.reply(`Insufficent permissions! ${emoji.random()}`);
+ //@ts-ignore
+ return msg.reply(`Insufficent permissions! ${emoji.random()}`).then(m => m.delete({ timeout: 3000 }))
}
}
}; \ No newline at end of file
diff --git a/src/commands/server/poll.ts b/src/commands/server/poll.ts
index 6230f86..7f7d3b0 100644
--- a/src/commands/server/poll.ts
+++ b/src/commands/server/poll.ts
@@ -2,6 +2,7 @@ import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando';
import { MessageEmbed } from 'discord.js';
//@ts-ignore no types
import emoji from 'emoji-random'
+import config from '../../config.json'
module.exports = class PollServer extends Command {
constructor(client: CommandoClient) {
@@ -15,32 +16,37 @@ module.exports = class PollServer extends Command {
usages: 5,
duration: 30
},
- userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'MANAGE_MESSAGES'],
+ userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'],
clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'],
guildOnly: true
});
}
//@ts-ignore this is not async
run(msg: CommandoMessage) {
- let messageArray = msg.content.split(' ')
- let args = messageArray.slice(1)
+ if (config['validUsers'].includes(msg.author.id)) {
+ let messageArray = msg.content.split(' ')
+ let args = messageArray.slice(1)
- if (!args || args.length < 1) {
- return msg.reply(`No poll content was specified. ${emoji.random()}`)
+ if (!args || args.length < 1) {
+ return msg.reply(`No poll content was specified. ${emoji.random()}`)
+ } else {
+ let emb = new MessageEmbed()
+ .setColor(0xFFCC4D)
+ .setFooter('React to vote.')
+ .setDescription(args.join(' '))
+ .setTitle(`Poll Created by ${msg.author.username} ${emoji.random()}`)
+ return msg.say(emb).then(fMsg => {
+ //@ts-ignore yes these exist
+ fMsg.react('✅')
+ //@ts-ignore yes these exist
+ fMsg.react('❎')
+ //@ts-ignore yes these exist
+ msg.delete({ timeout: 1000 })
+ })
+ }
} else {
- let emb = new MessageEmbed()
- .setColor(0xFFCC4D)
- .setFooter('React to vote.')
- .setDescription(args.join(' '))
- .setTitle(`Poll Created by ${msg.author.username} ${emoji.random()}`)
- return msg.say(emb).then(fMsg => {
- //@ts-ignore yes these exist
- fMsg.react('✅')
- //@ts-ignore yes these exist
- fMsg.react('❎')
- //@ts-ignore yes these exist
- msg.delete({ timeout: 1000 })
- })
+ //@ts-ignore
+ return msg.reply(`Insufficent permissions! ${emoji.random()}`).then(m => m.delete({ timeout: 3000 }))
}
}
}; \ No newline at end of file