2011-08-22 18:54:12 +02:00
|
|
|
var userCommands = function(dbot) {
|
|
|
|
var dbot = dbot;
|
|
|
|
|
|
|
|
var commands = {
|
|
|
|
'~kc': function(data, params) {
|
|
|
|
dbot.say('aisbot', '.karma ' + data.message.split(' ')[1]);
|
|
|
|
dbot.waitingForKarma = data.channel;
|
|
|
|
},
|
|
|
|
|
|
|
|
'~q': function(data, params) {
|
2011-08-26 13:42:44 +02:00
|
|
|
var q = data.message.valMatch(/^~q ([\d\w\s]*)/, 2)
|
|
|
|
if(q) {
|
2011-08-22 18:54:12 +02:00
|
|
|
dbot.say(data.channel, dbot.quotes.get(q[1].trim()));
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
'~qadd': function(data, params) {
|
2011-08-26 13:42:44 +02:00
|
|
|
var q = data.message.valMatch(/^~qadd ([\d\w\s]*)=(.+)$/, 3);
|
|
|
|
if(q) {
|
2011-08-22 18:54:12 +02:00
|
|
|
dbot.say(data.channel, dbot.quotes.add(q));
|
|
|
|
} else {
|
|
|
|
dbot.say(data.channel, 'Burn the invalid syntax!');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
'~qset': function(data, params) {
|
2011-08-26 13:42:44 +02:00
|
|
|
var q = data.message.match(/^~qset ([\d\w\s]*)=(.+)$/, 3);
|
|
|
|
if(q) {
|
2011-08-22 18:54:12 +02:00
|
|
|
dbot.say(data.channel, dbot.quotes.set(q));
|
2011-08-26 13:42:44 +02:00
|
|
|
} else {
|
|
|
|
dbot.say(data.channel, 'Burn the invalid syntax!');
|
2011-08-22 18:54:12 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
'~qcount': function(data, params) {
|
2011-08-26 13:42:44 +02:00
|
|
|
var q = data.message.valMatch(/^~qcount ([\d\w\s]*)/, 2);
|
|
|
|
if(q) {
|
|
|
|
dbot.say(data.channel, dbot.quotes.count(q[1].trim()));
|
2011-08-22 18:54:12 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
'~reality': function(data, params) {
|
|
|
|
dbot.say(data.channel, dbot.db.realiPuns.random());
|
|
|
|
},
|
|
|
|
|
|
|
|
'~d': function(data, params) {
|
|
|
|
dbot.say(data.channel, data.user + ': ' + dbot.db.quoteArrs['depressionbot'].random());
|
|
|
|
},
|
|
|
|
|
|
|
|
'~rq': function(data, params) {
|
|
|
|
dbot.say(data.channel, dbot.quotes.random());
|
|
|
|
},
|
|
|
|
|
|
|
|
'~kickcount': function(data, params) {
|
2011-08-24 02:57:52 +02:00
|
|
|
if(!dbot.db.kicks.hasOwnProperty(params[1])) {
|
2011-08-22 18:54:12 +02:00
|
|
|
dbot.say(data.channel, params[1] + ' has either never been kicked or does not exist.');
|
|
|
|
} else {
|
|
|
|
dbot.say(data.channel, params[1] + ' has been kicked ' + dbot.db.kicks[params[1]] + ' times.');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
return {
|
|
|
|
'listener': function(data) {
|
|
|
|
params = data.message.split(' ');
|
|
|
|
if(data.channel == dbot.name) data.channel = data.user;
|
|
|
|
|
|
|
|
if(commands.hasOwnProperty(params[0])) {
|
|
|
|
commands[params[0]](data, params);
|
2011-08-26 13:42:44 +02:00
|
|
|
dbot.save();
|
2011-08-22 18:54:12 +02:00
|
|
|
} else {
|
2011-08-26 13:42:44 +02:00
|
|
|
var q = data.message.valMatch(/^~([\d\w\s]*)/, 2)
|
|
|
|
if(q) {
|
2011-08-22 18:54:12 +02:00
|
|
|
dbot.say(data.channel, dbot.quotes.get(q[1].trim()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
'on': 'PRIVMSG'
|
2011-08-22 19:56:36 +02:00
|
|
|
};
|
2011-08-22 18:54:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
exports.fetch = function(dbot) {
|
|
|
|
return userCommands(dbot);
|
|
|
|
};
|