diff --git a/.gitignore b/.gitignore index 6f999a2d..2960e160 100644 --- a/.gitignore +++ b/.gitignore @@ -162,3 +162,8 @@ config/settings.yml .DS_Store docs-build/ +docs/site/ + +# extensions +tux/extensions/* +!tux/extensions/README.md \ No newline at end of file diff --git a/README.md b/README.md index 1c812a09..d38cb9e6 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ It is designed to provide a variety of features to the server, including moderat - Custom help command - Configuration system (`config/settings.yml.example`) - Dynamic role-based (access level) permission system +- Basic extensions system (see [extensions](tux/extensions/README.md)) ## Installation and Development diff --git a/tux/cog_loader.py b/tux/cog_loader.py index 7a253cff..728385de 100644 --- a/tux/cog_loader.py +++ b/tux/cog_loader.py @@ -349,6 +349,10 @@ async def setup(cls, bot: commands.Bot) -> None: with start_span("cog.load_regular", "Load regular cogs"): await cog_loader.load_cogs_from_folder(folder_name="cogs") + # Finally, load cogs from the extensions folder + with start_span("cog.load_extensions", "Load extension cogs"): + await cog_loader.load_cogs_from_folder(folder_name="extensions") + total_time = time.perf_counter() - start_time if sentry_sdk.is_initialized() and (current_span := sentry_sdk.get_current_span()): diff --git a/tux/extensions/README.md b/tux/extensions/README.md new file mode 100644 index 00000000..c026a7b3 --- /dev/null +++ b/tux/extensions/README.md @@ -0,0 +1,13 @@ +# Extensions +This is one of the more new/basic features of Tux, however it is a very powerful one. This will let you add custom commands to Tux without having to modify the code. This is done by creating a new file in the `tux/extensions` folder. The file is just a regular Discord.py cog. + +At the end of the day it is about the same as just adding a cog to the bot manually, you can also do this if you so wish (the src/ folder is docker mounted so modifications will be reflected in the container as well). + +> [!TIP] +> We scan subdirectories so you can use git submodules to add extensions! + +## Limitations +Unfortunately using extensions does come with some limitations: +- Everything is in the same category (Extensions) +- You cannot add your own data to the database schema (unless you want to modify the code), a solution might be added in the future. +- You cannot add extra packages (unless you modify the code), a solution might be added in the future.