tux icon indicating copy to clipboard operation
tux copied to clipboard

New directory structure proposal

Open kzndotsh opened this issue 1 year ago • 1 comments

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 ...

kzndotsh avatar Aug 22 '24 02:08 kzndotsh

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

basil-squared avatar Sep 20 '24 17:09 basil-squared

I don't think this makes much sense anymore given the current direction the project has taken. we use cogs heavily for core features, and most of them are fairly tightly integrated with the database system. I'm closing this issue because it's been stale for a very long time, and doesn't really make much sense given the current state of the bot.

anemoijereja-eden avatar Jun 23 '25 01:06 anemoijereja-eden