kud / ed-209

I'm an IRC bot!
8 stars 4 forks source link

Refactor commands and handlers #5

Closed madx closed 11 years ago

madx commented 11 years ago

I've started this work by separating commands and handlers from the main code and putting them into appropriate folders.

We could still to way better as they are very similar.

My proposition is to remove the distinction between the two of them, and only have modules (not in the NPM terminology) that watch the input message stream.

When a message can be processed by a module, it gets so, without blocking further processing by other modules.

This would probably allow some handlers to respond to the same kind of messages, but I guess it's not such a problem.

We could also use this refactoring to provide some handy utility functions to the module writers. My first thought is a checkTargetsMe that would check for a message that is addressed to the bot, it would be used to implement commands.