diff --git a/modules/kick/commands.js b/modules/kick/commands.js index 0e6c157..cdd844e 100644 --- a/modules/kick/commands.js +++ b/modules/kick/commands.js @@ -120,7 +120,6 @@ var commands = function(dbot) { dbot.api.nickserv.getUserHost(event.server, banee, function(host) { // Add host record entry if(host) { - if(!_.has(this.hosts, event.server)) this.hosts[event.server] = {}; this.hosts[event.server][banee] = host; // Create notify string diff --git a/modules/kick/kick.js b/modules/kick/kick.js index 9c25298..07de80a 100644 --- a/modules/kick/kick.js +++ b/modules/kick/kick.js @@ -1,14 +1,6 @@ var _ = require('underscore')._; -var kick = function(dbot) { - if(!_.has(dbot.db, 'hosts')) dbot.db.hosts = {}; - if(!_.has(dbot.db, 'tempBans')) dbot.db.tempBans = {}; - this.hosts = dbot.db.hosts; - this.tempBans = dbot.db.tempBans; - _.each(dbot.config.servers, function(v, k) { - this.hosts[k] = {}; - }, this); - +var kick = function(dbot) { this.api = { 'ban': function(server, host, channel) { dbot.instance.connections[server].send('MODE ' + channel + ' +b *!*@' + host); @@ -137,6 +129,16 @@ var kick = function(dbot) { if(_.has(dbot.modules, 'web')) { 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); };