forked from GitHub/dbot
remove command hooks [#471]
This commit is contained in:
parent
5bf6088453
commit
2fc5fc6992
@ -53,16 +53,6 @@ var api = function(dbot) {
|
|||||||
applies = true;
|
applies = true;
|
||||||
}
|
}
|
||||||
return applies;
|
return applies;
|
||||||
},
|
|
||||||
|
|
||||||
'addHook': function(command, callback) {
|
|
||||||
console.log('adding hook');
|
|
||||||
if(_.has(dbot.commands, command)) {
|
|
||||||
if(!_.has(dbot.commands[command], 'hooks')) {
|
|
||||||
dbot.commands[command].hooks = [];
|
|
||||||
}
|
|
||||||
dbot.commands[command].hooks.push(callback);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -32,11 +32,6 @@ var command = function(dbot) {
|
|||||||
try {
|
try {
|
||||||
var command = dbot.commands[commandName];
|
var command = dbot.commands[commandName];
|
||||||
var results = command.apply(dbot.modules[command.module], [event]);
|
var results = command.apply(dbot.modules[command.module], [event]);
|
||||||
if(_.has(command, 'hooks') && results !== false) {
|
|
||||||
_.each(command['hooks'], function(hook) {
|
|
||||||
hook.apply(hook.module, _.values(results));
|
|
||||||
}, this);
|
|
||||||
}
|
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
if(dbot.config.debugMode == true) {
|
if(dbot.config.debugMode == true) {
|
||||||
var stack = err.stack.split('\n').slice(1, dbot.config.debugLevel + 1);
|
var stack = err.stack.split('\n').slice(1, dbot.config.debugLevel + 1);
|
||||||
|
@ -15,8 +15,8 @@ var poll = function(dbot) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.onLoad = function() {
|
this.onLoad = function() {
|
||||||
dbot.api.command.addHook('~setaliasparent', this.internalAPI.updatePollNicks);
|
// dbot.api.command.addHook('~setaliasparent', this.internalAPI.updatePollNicks);
|
||||||
dbot.api.command.addHook('~mergeusers', this.internalAPI.updatePollNicks);
|
// dbot.api.command.addHook('~mergeusers', this.internalAPI.updatePollNicks);
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user