Update kick.js

This commit is contained in:
Luke Slater 2015-04-06 00:51:06 +03:00
parent 37d5fca1af
commit 0fdbc5fe68

View File

@ -128,6 +128,16 @@ var kick = function(dbot) {
this.on = 'KICK'; this.on = 'KICK';
this.onLoad = function() { this.onLoad = function() {
if(!_.has(dbot.db, 'hosts')) {
dbot.db.hosts = {};
_.each(dbot.config.servers, function(v, k) {
dbot.db.hosts[k] = {};
}, this);
}
if(!_.has(dbot.db, 'tempBans')) dbot.db.tempBans = {};
this.hosts = dbot.db.hosts;
this.tempBans = dbot.db.tempBans;
_.each(this.tempBans, function(bans, server) { _.each(this.tempBans, function(bans, server) {
_.each(bans, function(timeout, nick) { _.each(bans, function(timeout, nick) {
timeout = new Date(timeout); timeout = new Date(timeout);
@ -138,16 +148,6 @@ var kick = function(dbot) {
if(_.has(dbot.modules, 'web')) { if(_.has(dbot.modules, 'web')) {
dbot.api.web.addIndexLink('/bans', 'Ban List'); dbot.api.web.addIndexLink('/bans', 'Ban List');
} }
if(!_.has(dbot.db, 'hosts')) {
dbot.db.hosts = {};
_.each(dbot.config.servers, function(v, k) {
dbot.db.hosts[k] = {};
}, this);
}
if(!_.has(dbot.db, 'tempBans')) dbot.db.tempBans = {};
this.hosts = dbot.db.hosts;
this.tempBans = dbot.db.tempBans;
}.bind(this); }.bind(this);
}; };