2011-08-22 20:24:23 +02:00
|
|
|
var reality = function(dbot) {
|
|
|
|
var dbot = dbot;
|
|
|
|
|
|
|
|
return {
|
|
|
|
'listener': function(data, params) {
|
2011-08-26 16:34:49 +02:00
|
|
|
// Ternary for I/reality doesn't seem to work with the regex. Investigate.
|
2011-08-22 20:24:23 +02:00
|
|
|
if(data.user == 'reality') {
|
2011-08-26 16:34:49 +02:00
|
|
|
var once = data.message.valMatch(/^I ([\d\w\s,'-]* once)/, 2);
|
2011-08-24 19:23:00 +02:00
|
|
|
} else {
|
2011-08-26 16:34:49 +02:00
|
|
|
var once = data.message.valMatch(/^reality ([\d\w\s,'-]* once)/, 2);
|
2011-08-24 19:23:00 +02:00
|
|
|
}
|
|
|
|
|
2011-08-26 16:34:49 +02:00
|
|
|
if(once) {
|
2011-08-24 19:23:00 +02:00
|
|
|
dbot.db.realiPuns.push('reality ' + once[1] + '.');
|
|
|
|
dbot.instance.say(data.channel, '\'reality ' + once[1] + '.\' saved.');
|
|
|
|
dbot.save();
|
2011-08-22 20:24:23 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
'on': 'PRIVMSG'
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
exports.fetch = function(dbot) {
|
|
|
|
return reality(dbot);
|
|
|
|
}
|