From e1629f3a164859d3d1af7aab558c425c72dd5121 Mon Sep 17 00:00:00 2001 From: reality Date: Thu, 27 Jun 2013 16:51:32 +0000 Subject: [PATCH] Alias support for command.api.hasAccess [#515][#514][#511] --- modules/command/api.js | 6 +++--- modules/command/command.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/command/api.js b/modules/command/api.js index adaedac..f5be301 100644 --- a/modules/command/api.js +++ b/modules/command/api.js @@ -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 { diff --git a/modules/command/command.js b/modules/command/command.js index fd0f494..ba20716 100644 --- a/modules/command/command.js +++ b/modules/command/command.js @@ -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) {