~qcount command

This commit is contained in:
Luke Slater 2011-08-17 17:31:22 +01:00
parent 6d5c6a5a78
commit fa4495326f

12
run.js
View File

@ -89,7 +89,9 @@ instance.addListener('PRIVMSG', function(data) {
}); });
instance.addListener('PRIVMSG', function(data) { instance.addListener('PRIVMSG', function(data) {
if(instance.inChannel(data.channel) && data.message.startsWith('~')) { if(data.channel == name) data.channel = data.user;
if(data.message.startsWith('~')) {
var params = data.message.split(' '); var params = data.message.split(' ');
switch(params[0]) { switch(params[0]) {
case '~kc': case '~kc':
@ -130,6 +132,14 @@ instance.addListener('PRIVMSG', function(data) {
instance.say(data.channel, 'Burn the invalid syntax!'); instance.say(data.channel, 'Burn the invalid syntax!');
} }
break; break;
case '~qcount':
var qcount = data.message.match(/~qcount ([\d\w\s]*)/)[1].trim();
if(db.quoteArrs[qcount] != undefined) {
instance.say(data.channel, qcount + ' has ' + db.quoteArrs[qcount].length + ' quotes.');
} else {
instance.say(data.channel, qcount + ' doesn\'t exist.');
}
break;
case '~lamp': case '~lamp':
instance.say(data.channel, db.lampPuns.random()); instance.say(data.channel, db.lampPuns.random());
break; break;