3
0
mirror of https://github.com/reality/dbot.git synced 2025-01-26 20:14:32 +01:00

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; 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 Regex to event message, store result. Return false if it doesn't
* apply. * apply.

View File

@ -24,10 +24,8 @@ var command = function(dbot) {
if(this.api.isBanned(event.user, commandName)) { if(this.api.isBanned(event.user, commandName)) {
event.reply(dbot.t('command_ban', {'user': event.user})); event.reply(dbot.t('command_ban', {'user': event.user}));
} else { } else {
if(!this.api.isIgnoring(event.user, commandName) && dbot.api.ignore.isUserIgnoring(event.server, event.user, commandName, function(isIgnoring) {
!this.api.isIgnoring(event.channel, commandName) && if(!isIgnoring && this.api.hasAccess(event.user, commandName) && dbot.commands[commandName].disabled !== true) {
this.api.hasAccess(event.user, commandName) &&
dbot.commands[commandName].disabled !== true) {
if(this.api.applyRegex(commandName, event)) { if(this.api.applyRegex(commandName, event)) {
try { try {
var command = dbot.commands[commandName]; var command = dbot.commands[commandName];
@ -55,6 +53,7 @@ var command = function(dbot) {
} }
} }
} }
}.bind(this));
} }
}.bind(this); }.bind(this);
this.on = 'PRIVMSG'; this.on = 'PRIVMSG';

View File

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