forked from GitHub/dbot
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);
|
this.rawModules.push(rawModule);
|
||||||
|
|
||||||
if(module.listener) {
|
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) {
|
if(module.onLoad) {
|
||||||
|
Loading…
Reference in New Issue
Block a user