zostay / Bot-Backbone

A generic bot-writing framework
8 stars 1 forks source link

Better tools for adding/removing services on the fly #4

Open zostay opened 8 years ago

zostay commented 8 years ago

I am already working on some of the prerequisites for this right now. Basically, it should be possible to add services and remove services on the fly. This would allow, for example, a bot to join a channel and configure services for that channel and then remove those services when the bot leaves that channel.

Adding on the fly will soon be possible because of the initialization tracking I am adding, but to handle the reverse, we really need to be able to keep track of when one service depends on another. The current solution I'm working on will sort of do the job, but remains a little naïve as a general dependency tracking system.

It would be nice, for example, to say something like:

$bot->remove_service('general_chat', and_dependencies => 1);

This could then remove all the dependencies, including custom dispatcher, and services tied to this group. A better syntax for tying related services together is needed.