Open user4752 opened 6 months ago
That could be kinda nice, BotMain is getting really bloated with the number of base class references it currently has. I would love to see it more lean if possible.
Once #55 has been reviewed discussion on how commands can be logically organized can occur in order to further development in this idea.
I have created a sample bot using extensions and cogs have found they're extremely easy to setup, deciding on how to group commands is the difficult part.
Next steps on testing for me are
Yeah, I think reorganizing via cogs would be nice. Some of these classes are so big it can be hard to find things. I don't think necessarily we need to do a full on refactor though, but reorg would be good.
After hearing you state you wished to reorganize the code, I was reminded of a feature discordjs has and read up on the docs for discordpy and was happy to find out it does also implement a similar feature.
Discordpy extensions allow separating out sections of code into sub-modules as you had indicated you thought about doing, and allow for hot reloading and loading of new code without needing to shut the bot down in order to do so (assuming the main bot process has been coded in a sufficient manner to allow this)
Discordpy cogs allow grouping of functions into a shared class space inside of modules which provide skeleton for a framework to run commands and bind listeners to event emitted from the discord api.
Cogs can be the basis for organizing of slash commands into groups. Cogs would also simplify parameter passing between classes and functions as cogs classes can be referenced externally via the
get_cog()
function call.