From d6b56db06e4b69ed0b48b6485b087771d852e0f9 Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Fri, 25 May 2012 16:03:36 +0100 Subject: [PATCH] Fix puns by faking an event and calling it straight in jsbot --- modules/puns.js | 11 ++++++----- run.js | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/modules/puns.js b/modules/puns.js index 00c70bc..1693c5f 100644 --- a/modules/puns.js +++ b/modules/puns.js @@ -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) } } }, diff --git a/run.js b/run.js index 3f7af54..cdf1fa1 100644 --- a/run.js +++ b/run.js @@ -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