Alias support for command.api.hasAccess [#515][#514][#511]

This commit is contained in:
reality 2013-06-27 16:51:32 +00:00
parent 68b0977bae
commit e1629f3a16
2 changed files with 4 additions and 4 deletions

View File

@ -5,18 +5,18 @@ var api = function(dbot) {
/**
* Does the user have the correct access level to use the command?
*/
'hasAccess': function(server, user, command, callback) {
'hasAccess': function(user, command, callback) {
var accessNeeded = dbot.commands[command].access;
if(accessNeeded == 'admin' || accessNeeded == 'moderator') {
var allowedNicks = dbot.config.admins;
if(accessNeeded == 'moderator') allowedNicks = _.union(allowedNicks, dbot.config.moderators);
if(!_.include(allowedNicks, user)) {
if(!_.include(allowedNicks, user.primaryNick)) {
callback(false);
} else {
if(_.has(dbot.modules, 'nickserv') && this.config.useNickserv == true) {
dbot.api.nickserv.auth(server, user, function(result) {
dbot.api.nickserv.auth(user.server, user.currentNick, function(result) {
callback(result);
});
} else {

View File

@ -20,7 +20,7 @@ var command = function(dbot) {
}
}
this.api.hasAccess(event.server, event.user, commandName, function(hasAccess) {
this.api.hasAccess(event.rUser, commandName, function(hasAccess) {
dbot.api.ignore.isUserIgnoring(event.rUser, commandName, function(isIgnoring) {
dbot.api.ignore.isUserBanned(event.rUser, commandName, function(isBanned) {
if(isBanned) {