diff --git a/modules/command/api.js b/modules/command/api.js index 11b7204..294172b 100644 --- a/modules/command/api.js +++ b/modules/command/api.js @@ -5,16 +5,24 @@ var api = function(dbot) { /** * Does the user have the correct access level to use the command? */ - 'hasAccess': function(user, command, callback) { + 'hasAccess': function(user, channel, command, callback) { var accessNeeded = dbot.commands[command].access; - if(accessNeeded == 'admin' || accessNeeded == 'moderator' || accessNeeded == 'power_user') { + if(accessNeeded == 'admin' || accessNeeded == 'moderator' || + accessNeeded == 'power_user' || accessNeeded == 'voice') { var allowedNicks = dbot.config.admins; if(accessNeeded == 'moderator') allowedNicks = _.union(allowedNicks, dbot.config.moderators); if(accessNeeded == 'power_user') { allowedNicks = _.union(allowedNicks, dbot.config.moderators); allowedNicks = _.union(allowedNicks, dbot.config.power_users); } + if(accessNeeded == 'voice') { + allowedNicks = _.union(allowedNicks, dbot.config.moderators); + allowedNicks = _.union(allowedNicks, dbot.config.power_users); + allowedNicks = _.union(allowedNicks, _.filter(channel, function(nick) { + return nick.op == true || nick.voice == true; + })); + } if(!_.include(allowedNicks, user.primaryNick)) { callback(false); diff --git a/modules/command/command.js b/modules/command/command.js index 35c7347..486cc61 100644 --- a/modules/command/command.js +++ b/modules/command/command.js @@ -61,7 +61,7 @@ var command = function(dbot) { } } - this.api.hasAccess(event.rUser, commandName, function(hasAccess) { + this.api.hasAccess(event.rUser, event.channel, commandName, function(hasAccess) { dbot.api.ignore.isUserIgnoring(event.rUser, commandName, function(isIgnoring) { dbot.api.ignore.isUserBanned(event.rUser, commandName, function(isBanned) { if(isBanned) { diff --git a/modules/kick/commands.js b/modules/kick/commands.js index 587d118..18448cb 100644 --- a/modules/kick/commands.js +++ b/modules/kick/commands.js @@ -269,8 +269,8 @@ var commands = function(dbot) { commands['~kickcount'].access = 'regular'; commands['~kickstats'].access = 'regular'; - commands['~quiet'].access = 'power_user'; - commands['~unquiet'].access = 'power_user'; + commands['~quiet'].access = 'voice'; + commands['~unquiet'].access = 'voice'; commands['~ckick'].regex = [/^~ckick ([^ ]+) ([^ ]+) (.+)$/, 4]; commands['~nban'].regex = /^~nban ([\d\.^ ]+)?([^ ]+) (.+)$/;