diff options
| author | Justin <jtsshieh@outlook.com> | 2019-10-30 22:28:49 -0400 |
|---|---|---|
| committer | Justin <jtsshieh@outlook.com> | 2019-10-30 22:28:49 -0400 |
| commit | 2c3bf24f5996753df4a2d4456949fc0b636f6366 (patch) | |
| tree | 27700e9b0557d23a6fb0cbd9d4058d60d725caa0 /events | |
| parent | 5d778acf2066546de30f53d4d10c92a043a44a3a (diff) | |
| download | PokeBot-2c3bf24f5996753df4a2d4456949fc0b636f6366.tar.gz PokeBot-2c3bf24f5996753df4a2d4456949fc0b636f6366.tar.bz2 PokeBot-2c3bf24f5996753df4a2d4456949fc0b636f6366.zip | |
Added an optional checkPermission function and upgraded quick.db.
Diffstat (limited to 'events')
| -rw-r--r-- | events/message.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/events/message.js b/events/message.js index d485ed3..21463a7 100644 --- a/events/message.js +++ b/events/message.js @@ -50,9 +50,15 @@ function parseCommand(bot, msg) { } if (cmd) { - if (cmd.conf.guildOnly == true) { - if (!msg.channel.guild) { - return msg.reply('This command can only be ran in a guild.'); + if (cmd.conf.guildOnly == true && !msg.channel.guild) { + return msg.reply('This command can only be ran in a guild.'); + } + if (cmd.checkPermission != null) { + let result = cmd.checkPermission(bot, msg.member) + if (result != true) + { + if (result == false) return msg.reply('You are not authorized to run this command.'); + return msg.reply(result); } } try { |
