Forgot to add ignore.api to last commit

This commit is contained in:
reality 2013-04-10 07:50:47 +00:00
parent b56ac4164a
commit 53c8ca9672

30
modules/ignore/api.js Normal file
View File

@ -0,0 +1,30 @@
var _ = require('underscore')._,
databank = require('databank'),
AlreadyExistsError = databank.AlreadyExistsError,
NoSuchThingError = databank.NoSuchThingError,
NotImplementedError = databank.NotImplementedError;
var api = function(dbot) {
return {
'isUserIgnoring': function(server, user, item, callback) {
dbot.api.users.resolveUser(server, user, function(user) {
this.db.read('ignores', user.id, function(err, ignores) {
var isIgnoring = false;
if(ignores) {
if(_.has(dbot.commands, item)) {
item = moduleName = dbot.commands[item].module;
}
if(_.include(ignores.ignores, item)) {
isIgnoring = true;
}
}
callback(isIgnoring);
});
}.bind(this));
}
};
}
exports.fetch = function(dbot) {
return api(dbot);
};