Closed TimTims closed 9 years ago
<NanoSector> Setup a constructor that returns the hooks that need to be registered, then the bot registers the hooks
<NanoSector> The class can't register by itself because it's half initialised
<NanoSector> and you need to pass an instance of the class for the bot to be able to call it
<NanoSector> hmm
<NanoSector> Say a class contains function AHook, it'd return an array('the_hook_name', 'AHook');
<NanoSector> then the bot would know that it needs to hook the function AHook of class A into hook the_hook_name, and it can register it
<NanoSector> $bot->hooks->register('the_hook_name', array($class_A, 'AHook'));
<TimTims> Ok
<NanoSector> Then the hooks manager should check the given input and check if the function exists, actually register the function and keep track of it
<NanoSector> If we want to get into dynamic removing/adding of commands we have some challenges to accept as well
<NanoSector> Removing a command should not need cleaning up of hooks persay since the hook system will check if a function exists before calling it
<NanoSector> But adding a command needs to process the adding of hooks all over
I guess we'll implement a proper event manager for modules to use.
A module should be able to:
The same concept as hooks I think. Variables would be passed by reference so the listeners can use them.
I think this is pretty much covered with the event manager in the 'new' bot, unless you have ideas that take it further?
The basic thing is implemented, closing the issue. We can make more improvements later down the line.
Implement
Hooks
System.