remove command hooks [#471]

This commit is contained in:
reality 2013-05-25 22:09:07 +00:00
parent 5bf6088453
commit 2fc5fc6992
3 changed files with 2 additions and 17 deletions

View File

@ -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);
}
} }
}; };
}; };

View File

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

View File

@ -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);
}; };