The IMessageAction interface approach is inefficient. A service would be much more clean. .Enable(string key) being one example of what can be done with a service. This will also allow MessageHandlers to be toggled via command.
Also, I suggest turning the ContactsBot class back into the Program class, while breaking everything out of it, turning AsyncMain into a function that does nothing more than initialize all the services of the bot. Turning the root functionality into a class seems useless, without the bot being a component of a greater whole.
The bot should be, in essence, a collection of services that work with each other and for each other. The root should reflect that. If it becomes "too large", it can be broken down into stages, each stage it's own method in Program
The
IMessageAction
interface approach is inefficient. A service would be much more clean..Enable(string key)
being one example of what can be done with a service. This will also allow MessageHandlers to be toggled via command.Also, I suggest turning the
ContactsBot
class back into theProgram
class, while breaking everything out of it, turningAsyncMain
into a function that does nothing more than initialize all the services of the bot. Turning the root functionality into a class seems useless, without the bot being a component of a greater whole.The bot should be, in essence, a collection of services that work with each other and for each other. The root should reflect that. If it becomes "too large", it can be broken down into stages, each stage it's own method in
Program