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 {
'listener': function(event) {
event.user = dbot.cleanNick(data.user);
event.user = dbot.cleanNick(event.user);
if((dbot.db.ignores.hasOwnProperty(event.user) &&
dbot.db.ignores[event.user].include(name)) == false) {
if(dbot.moduleNames.include('quotes') &&
dbot.db.quoteArrs.hasOwnProperty(data.user)) {
data.message = '~q ' + data.user.toLowerCase();
var params = data.message.split(' ');
dbot.commands[params[0]](data, params);
dbot.db.quoteArrs.hasOwnProperty(event.user)) {
event.message = '~q ' + event.user;
event.action = 'PRIVMSG';
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
this.name = this.config.name || 'dbox';
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';
// It's the user's responsibility to fill this data structure up properly in