From bd6c42d57e0ec3fabd11e40485ffd08c018d7f8f Mon Sep 17 00:00:00 2001 From: reality Date: Sun, 23 Dec 2012 16:54:30 +0000 Subject: [PATCH] Allow listeners to be attached to multiple event types. --- run.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/run.js b/run.js index 187996d..67911a1 100644 --- a/run.js +++ b/run.js @@ -169,7 +169,14 @@ DBot.prototype.reloadModules = function() { this.rawModules.push(rawModule); if(module.listener) { - this.instance.addListener(module.on, module.name, module.listener); + var listenOn = module.on; + if(!(listenOn instanceof Array)) { + listenOn = [listenOn]; + } + + listenOn.each(function(on) { + this.instance.addListener(on, module.name, module.listener); + }.bind(this)); } if(module.onLoad) {