From 44dd69a1664f482d634d67d22dbb092f7e819afc Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Wed, 17 Aug 2011 17:51:47 +0100 Subject: [PATCH] Add in the admin bit. --- run.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/run.js b/run.js index 1dc0335..d114532 100644 --- a/run.js +++ b/run.js @@ -22,7 +22,7 @@ var instance = jsbot.createJSBot(name, 'elara.ivixor.net', 6667, function() { instance.addListener('JOIN', function(data) { if(data.user == 'Lamp') { instance.say(data.channel, db.lampPuns.random()); - } else if(data.user == 'Reality') { + } else if(data.user == 'reality') { instance.say(data.channel, db.realiPuns.random()); } else if(instance.inChannel(data.channel)) { instance.say('aisbot', '.karma ' + data.user); @@ -84,6 +84,14 @@ instance.addListener('PRIVMSG', function(data) { var m = params.slice(2).join(' '); instance.say(c, m); break; + case 'add': + // not very safe, but you're the admin so suck it + var c = params[1]; + var m = params.slice(2).join(' '); + db[c].push(m); + fs.writeFile('db.json', JSON.stringify(db, null, ' ')); + instance.say(admin, 'Added.'); + break; } } });