discord-csharp / Contacts

Your friendly neighborhood C# Discord server bot
MIT License
7 stars 3 forks source link

Remove Interface Abuse - Rise of the Services #38

Open khionu opened 7 years ago

khionu commented 7 years ago

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