allthingslinux / tux

Tux is an all in one bot for the All Things Linux discord server.
https://discord.gg/linux
GNU General Public License v3.0
85 stars 26 forks source link

New directory structure proposal #423

Open kzndotsh opened 3 months ago

kzndotsh commented 3 months ago

Per recent the developer documentation I have been working on:

There comes a point in your bot’s development when you want to organize a collection of commands, listeners, and some state into one class. Cogs allow you to do just that. It should be noted that cogs are typically used alongside with Extensions. An extension at its core is a python file with an entry point called setup. This setup function must be a Python coroutine. It takes a single parameter of the Bot that loads the extension. With regards to Tux, we typically define one cog per extension. This allows us to keep our code organized and modular. Furthermore, we have a CogLoader class that loads our cogs (technically, extensions) from the cogs directory and registers them with the bot at startup. tl;dr - Extensions are imported "modules", cogs are classes that are subclasses of commands.Cog.

Based on reviewing the wording inside https://github.com/allthingslinux/tux/blob/main/tux/cog_loader.py and the way our directory structure is currently...

It seems like the way we are documenting may create some confusion although not hard to resolve, still confusion nonetheless.

My suggested directory structure is below:

.
└── tux
    ├── extensions
    │   ├── cogs
    │   └── handlers (event, activity, error, etc)
    ├── ui
    ├── utils
    ├── database
    ├── wrappers
    └── etc ...
FluxC0 commented 2 months ago

hmm, I see. I personally have no objections, because this will most likely better the project and make it cleaner.