3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-28 05:32:50 +01:00

adding initial support for wildcard ignores/bans

This commit is contained in:
John Maguire 2013-03-21 06:34:33 -04:00
parent d197a30b17
commit e90572aebf

View File

@ -4,8 +4,10 @@ var api = function(dbot) {
return {
'isBanned': function(user, command) {
var banned = false;
if(_.has(dbot.db.bans, command)) {
if(_.include(dbot.db.bans[command], user) || _.include(dbot.db.bans['*'], user)) {
if(_.has(dbot.db.bans, user)) {
if(_.include(dbot.db.bans[user], command) ||
_.include(dbot.db.bans[user], dbot.commands[command].module) ||
_.include(dbot.db.bans[user], '*')) {
banned = true;
}
}
@ -39,7 +41,8 @@ var api = function(dbot) {
'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], module) ||
_.include(dbot.db.ignores[item], '*')));
},
/**