isIgnoring now belongs in ignore.api, changes in command to reflect this. ~ignore now operational for commands. [#331]

This commit is contained in:
reality 2013-04-10 01:28:53 +00:00
parent 6cea1256ce
commit b56ac4164a
4 changed files with 29 additions and 40 deletions

View File

@ -35,16 +35,6 @@ var api = function(dbot) {
return access;
},
/**
* Is item (user or channel) ignoring command?
*/
'isIgnoring': function(item, command) {
var module = dbot.commands[command].module;
return (_.has(dbot.db.ignores, item) &&
(_.include(dbot.db.ignores[item], module) ||
_.include(dbot.db.ignores[item], '*')));
},
/**
* Apply Regex to event message, store result. Return false if it doesn't
* apply.

View File

@ -24,10 +24,8 @@ var command = function(dbot) {
if(this.api.isBanned(event.user, commandName)) {
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) {
dbot.api.ignore.isUserIgnoring(event.server, event.user, commandName, function(isIgnoring) {
if(!isIgnoring && this.api.hasAccess(event.user, commandName) && dbot.commands[commandName].disabled !== true) {
if(this.api.applyRegex(commandName, event)) {
try {
var command = dbot.commands[commandName];
@ -55,6 +53,7 @@ var command = function(dbot) {
}
}
}
}.bind(this));
}
}.bind(this);
this.on = 'PRIVMSG';

View File

@ -1,5 +1,5 @@
var _ = require('underscore')._,
uuid = require('node-uuid');
uuid = require('node-uuid'),
databank = require('databank'),
AlreadyExistsError = databank.AlreadyExistsError,
NoSuchThingError = databank.NoSuchThingError,