forked from GitHub/dbot
voiced in chan can quiet
This commit is contained in:
parent
4940eec5ce
commit
a238994e0f
@ -5,16 +5,24 @@ var api = function(dbot) {
|
|||||||
/**
|
/**
|
||||||
* Does the user have the correct access level to use the command?
|
* 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;
|
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;
|
var allowedNicks = dbot.config.admins;
|
||||||
if(accessNeeded == 'moderator') allowedNicks = _.union(allowedNicks, dbot.config.moderators);
|
if(accessNeeded == 'moderator') allowedNicks = _.union(allowedNicks, dbot.config.moderators);
|
||||||
if(accessNeeded == 'power_user') {
|
if(accessNeeded == 'power_user') {
|
||||||
allowedNicks = _.union(allowedNicks, dbot.config.moderators);
|
allowedNicks = _.union(allowedNicks, dbot.config.moderators);
|
||||||
allowedNicks = _.union(allowedNicks, dbot.config.power_users);
|
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)) {
|
if(!_.include(allowedNicks, user.primaryNick)) {
|
||||||
callback(false);
|
callback(false);
|
||||||
|
@ -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.isUserIgnoring(event.rUser, commandName, function(isIgnoring) {
|
||||||
dbot.api.ignore.isUserBanned(event.rUser, commandName, function(isBanned) {
|
dbot.api.ignore.isUserBanned(event.rUser, commandName, function(isBanned) {
|
||||||
if(isBanned) {
|
if(isBanned) {
|
||||||
|
@ -269,8 +269,8 @@ var commands = function(dbot) {
|
|||||||
|
|
||||||
commands['~kickcount'].access = 'regular';
|
commands['~kickcount'].access = 'regular';
|
||||||
commands['~kickstats'].access = 'regular';
|
commands['~kickstats'].access = 'regular';
|
||||||
commands['~quiet'].access = 'power_user';
|
commands['~quiet'].access = 'voice';
|
||||||
commands['~unquiet'].access = 'power_user';
|
commands['~unquiet'].access = 'voice';
|
||||||
|
|
||||||
commands['~ckick'].regex = [/^~ckick ([^ ]+) ([^ ]+) (.+)$/, 4];
|
commands['~ckick'].regex = [/^~ckick ([^ ]+) ([^ ]+) (.+)$/, 4];
|
||||||
commands['~nban'].regex = /^~nban ([\d\.^ ]+)?([^ ]+) (.+)$/;
|
commands['~nban'].regex = /^~nban ([\d\.^ ]+)?([^ ]+) (.+)$/;
|
||||||
|
Loading…
Reference in New Issue
Block a user