-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Command Hooks #86
Comments
This will be implemented as part of #85 |
So we can achieve something like this relatively simply with a couple of lines in the command module, like so: dbot.hooks[commandName].each(function(hook) {
hook();
}.bind(this)); However, the question is - how do we pass relevant information to the hook function? For example, one of our initial hooks is going to be for fixStats upon the calling of ~mergeusers or ~setaliasparent. How do we pass the oldUser value from these commands to the fixStats hook function? |
A parameter object maybe? On Thu, Jan 10, 2013 at 7:00 AM, Luke Slater notifications@github.comwrote:
|
You mean pass the params which are passed to the command? That's a little messy as then the hooks will have to do their own parsing of the input. |
Going to do this by having commands open to hooks return data at the end for use. |
* Command API function to addHook(command, callback) * Commands open to callbacks must return information or indicate failed completion by return false * Hooks to be added in module onLoad * Command loop checks for available hooks and return state, then applies with module scope. * onLoad running moved to end of all module loading to facilitate this without order problems * Added example for ~qadd dent
Completed with previous commit. |
No description provided.
The text was updated successfully, but these errors were encountered: