From 013908d6b2512ff69fbf5ff82403720e45d2eb62 Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Mon, 22 Aug 2011 21:46:43 +0100 Subject: [PATCH] fixed kick --- admin.js | 9 ++++----- kick.js | 6 ++++-- puns.js | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/admin.js b/admin.js index af4cfb9..48a7379 100644 --- a/admin.js +++ b/admin.js @@ -4,22 +4,21 @@ var adminCommands = function(dbot) { var commands = { 'join': function(data, params) { dbot.join(params[1]); - dbot.say(admin, 'Joined ' + params[1]); + dbot.say(dbot.admin, 'Joined ' + params[1]); }, 'part': function(data, params) { dbot.part(params[1]); - dbot.say(admin); }, 'reload': function(data, params) { - dbot.say(admin, 'Reloading DB.'); + dbot.say(dbot.admin, 'Reloading DB.'); try { dbot.db = JSON.parse(fs.readFileSync('db.json', 'utf-8')); } catch(err) { - dbot.say(admin, 'DB reload failed.'); + dbot.say(dbot.admin, 'DB reload failed.'); } finally { - dbot.say(admin, 'DB Reload successful.'); + dbot.say(dbot.admin, 'DB Reload successful.'); } }, diff --git a/kick.js b/kick.js index 2395898..63e6957 100644 --- a/kick.js +++ b/kick.js @@ -1,12 +1,14 @@ var kick = function(dbot) { + var dbot = dbot; + return { 'listener': function(data) { if(data.kickee == dbot.name) { - dbot.instance.join(data.channel); // make interface + dbot.instance.join(data.channel); // TODO: make interface dbot.say(data.channel, 'Thou shalt not kick ' + dbot.name); dbot.db.kicks[name] += 1; } else { - if(dbot.db.kicks[data.kickee] == undefined) { + if(dbot.db.kicks.hasOwnProperty(data.kickee)) { dbot.db.kicks[data.kickee] = 1; } else { dbot.db.kicks[data.kickee] += 1; diff --git a/puns.js b/puns.js index 3ad0129..969c399 100644 --- a/puns.js +++ b/puns.js @@ -7,7 +7,7 @@ var puns = function(dbot) { dbot.say(data.channel, dbot.db.quoteArrs.lamp.random()); } else if(data.user == 'reality') { dbot.instance.say(data.channel, dbot.db.realiPuns.random()); - } else if(instance.inChannel(data.channel)) { + } else if(dbot.instance.inChannel(data.channel)) { dbot.instance.say('aisbot', '.karma ' + data.user); dbot.waitingForKarma = data.channel; }