Consolidate puns and quotes modules [#90]

This commit is contained in:
reality 2012-12-30 18:53:20 +00:00
parent 887e854012
commit ae902e3c21
2 changed files with 30 additions and 50 deletions

View File

@ -1,25 +0,0 @@
var puns = function(dbot) {
var name = 'puns';
var dbot = dbot;
return {
'name': name,
'ignorable': true,
'listener': function(event) {
event.user = dbot.cleanNick(event.user);
if(dbot.config.moduleNames.include('quotes') &&
dbot.db.quoteArrs.hasOwnProperty(event.user)) {
event.message = '~q ' + event.user;
event.action = 'PRIVMSG';
event.params = event.message.split(' ');
dbot.instance.emit(event);
}
},
'on': 'JOIN'
};
}
exports.fetch = function(dbot) {
return puns(dbot);
};

View File

@ -265,7 +265,7 @@ var quotes = function(dbot) {
'commands': commands, 'commands': commands,
'listener': function(event) { 'listener': function(event) {
// Reality Once listener if(event.action == 'PRIVMSG') {
if((dbot.db.ignores.hasOwnProperty(event) && if((dbot.db.ignores.hasOwnProperty(event) &&
dbot.db.ignores[event.user].include(name)) == false) { dbot.db.ignores[event.user].include(name)) == false) {
if(event.user == 'reality') { if(event.user == 'reality') {
@ -294,9 +294,14 @@ var quotes = function(dbot) {
} }
} }
} }
} else if(event.action == 'JOIN') {
event.message = '~q ' + event.user;
event.action = 'PRIVMSG';
event.params = event.message.split(' ');
dbot.instance.emit(event);
}
}, },
'on': ['PRIVMSG', 'JOIN']
'on': 'PRIVMSG'
}; };
}; };