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:
parent
2bc0bbc439
commit
bd6c42d57e
9
run.js
9
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user