Add in the admin bit.

This commit is contained in:
Luke Slater 2011-08-17 17:51:47 +01:00
parent fa4495326f
commit 44dd69a166

10
run.js
View File

@ -22,7 +22,7 @@ var instance = jsbot.createJSBot(name, 'elara.ivixor.net', 6667, function() {
instance.addListener('JOIN', function(data) { instance.addListener('JOIN', function(data) {
if(data.user == 'Lamp') { if(data.user == 'Lamp') {
instance.say(data.channel, db.lampPuns.random()); instance.say(data.channel, db.lampPuns.random());
} else if(data.user == 'Reality') { } else if(data.user == 'reality') {
instance.say(data.channel, db.realiPuns.random()); instance.say(data.channel, db.realiPuns.random());
} else if(instance.inChannel(data.channel)) { } else if(instance.inChannel(data.channel)) {
instance.say('aisbot', '.karma ' + data.user); instance.say('aisbot', '.karma ' + data.user);
@ -84,6 +84,14 @@ instance.addListener('PRIVMSG', function(data) {
var m = params.slice(2).join(' '); var m = params.slice(2).join(' ');
instance.say(c, m); instance.say(c, m);
break; 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;
} }
} }
}); });