Skip to content

Commit b731156

Browse files
authored
Merge pull request #828 from allthingslinux/basic-extensions
feat: add extensions system and update README
2 parents fef5385 + 1723501 commit b731156

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,3 +162,8 @@ config/settings.yml
162162
.DS_Store
163163

164164
docs-build/
165+
docs/site/
166+
167+
# extensions
168+
tux/extensions/*
169+
!tux/extensions/README.md

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ It is designed to provide a variety of features to the server, including moderat
5050
- Custom help command
5151
- Configuration system (`config/settings.yml.example`)
5252
- Dynamic role-based (access level) permission system
53+
- Basic extensions system (see [extensions](tux/extensions/README.md))
5354

5455
## Installation and Development
5556

tux/cog_loader.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,10 @@ async def setup(cls, bot: commands.Bot) -> None:
349349
with start_span("cog.load_regular", "Load regular cogs"):
350350
await cog_loader.load_cogs_from_folder(folder_name="cogs")
351351

352+
# Finally, load cogs from the extensions folder
353+
with start_span("cog.load_extensions", "Load extension cogs"):
354+
await cog_loader.load_cogs_from_folder(folder_name="extensions")
355+
352356
total_time = time.perf_counter() - start_time
353357

354358
if sentry_sdk.is_initialized() and (current_span := sentry_sdk.get_current_span()):

tux/extensions/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Extensions
2+
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.
3+
4+
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).
5+
6+
> [!TIP]
7+
> We scan subdirectories so you can use git submodules to add extensions!
8+
9+
## Limitations
10+
Unfortunately using extensions does come with some limitations:
11+
- Everything is in the same category (Extensions)
12+
- 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.
13+
- You cannot add extra packages (unless you modify the code), a solution might be added in the future.

0 commit comments

Comments
 (0)