Fix puns by faking an event and calling it straight in jsbot

This commit is contained in:
Luke Slater 2012-05-25 16:03:36 +01:00
parent 979399de46
commit d6b56db06e
2 changed files with 7 additions and 6 deletions

View File

@ -4,15 +4,16 @@ var puns = function(dbot) {
return { return {
'listener': function(event) { 'listener': function(event) {
event.user = dbot.cleanNick(data.user); event.user = dbot.cleanNick(event.user);
if((dbot.db.ignores.hasOwnProperty(event.user) && if((dbot.db.ignores.hasOwnProperty(event.user) &&
dbot.db.ignores[event.user].include(name)) == false) { dbot.db.ignores[event.user].include(name)) == false) {
if(dbot.moduleNames.include('quotes') && if(dbot.moduleNames.include('quotes') &&
dbot.db.quoteArrs.hasOwnProperty(data.user)) { dbot.db.quoteArrs.hasOwnProperty(event.user)) {
data.message = '~q ' + data.user.toLowerCase(); event.message = '~q ' + event.user;
var params = data.message.split(' '); event.action = 'PRIVMSG';
dbot.commands[params[0]](data, params); event.params = event.message.split(' ');
dbot.instance.emit(event)
} }
} }
}, },

2
run.js
View File

@ -53,7 +53,7 @@ var DBot = function(timers) {
// Populate bot properties with config data // Populate bot properties with config data
this.name = this.config.name || 'dbox'; this.name = this.config.name || 'dbox';
this.admin = this.config.admin || [ 'reality' ]; this.admin = this.config.admin || [ 'reality' ];
this.moduleNames = this.config.modules || [ 'command', 'js', 'quotes', 'admin' ]; this.moduleNames = this.config.modules || [ 'admin', 'command', 'dice', 'js', 'kick', 'puns', 'quotes', 'spelling', 'youare' ];
this.language = this.config.language || 'english'; this.language = this.config.language || 'english';
// It's the user's responsibility to fill this data structure up properly in // It's the user's responsibility to fill this data structure up properly in