3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-28 05:32:50 +01:00

Allow listeners to be attached to multiple event types.

This commit is contained in:
reality 2012-12-23 16:54:30 +00:00
parent 2bc0bbc439
commit bd6c42d57e

9
run.js
View File

@ -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) {