diff --git a/modules/command/README.md b/modules/command/README.md index 6f52a18..619fa04 100644 --- a/modules/command/README.md +++ b/modules/command/README.md @@ -11,11 +11,12 @@ Command flow: command name 2. Is the user banned from running the given command? 3. Is the user ignoring the command? -3. Does the use have the access level to run the command? -4. Is the command set as disabled? -4. Apply regex to the command, pass into event object. +4. Is the channel ignoring the command? +5. Does the use have the access level to run the command? +6. Is the command set as disabled? +7. Apply regex to the command, pass into event object. * If regex does not apply, show usage info. -5. Run the command. +8. Run the command. This is the only module which is force loaded, even if it's not specified in the configuration file. diff --git a/modules/command/api.js b/modules/command/api.js index 2347977..51202e9 100644 --- a/modules/command/api.js +++ b/modules/command/api.js @@ -34,15 +34,12 @@ var api = function(dbot) { }, /** - * Is user ignoring command? + * Is item (user or channel) ignoring command? */ - 'isIgnoring': function(user, command) { + 'isIgnoring': function(item, command) { var module = dbot.commands[command].module; - var ignoring = false; - if(_.has(dbot.db.ignores, user) && _.include(dbot.db.ignores[user], module)) { - ignoring = true; - } - return ignoring; + return (_.has(dbot.db.ignores, item) && + _.include(dbot.db.ignores[item], module)); }, /** diff --git a/modules/command/command.js b/modules/command/command.js index 0895a94..935f6e0 100644 --- a/modules/command/command.js +++ b/modules/command/command.js @@ -25,6 +25,7 @@ var command = function(dbot) { event.reply(dbot.t('command_ban', {'user': event.user})); } else { if(!this.api.isIgnoring(event.user, commandName) && + !this.api.isIgnoring(event.channel, commandName) && this.api.hasAccess(event.user, commandName) && dbot.commands[commandName].disabled !== true) { if(this.api.applyRegex(commandName, event)) {