Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
6cd508c
The start of the new config system
ajax146 Jun 6, 2026
1719232
Clean up some unused variables in application
ajax146 Jun 6, 2026
3cd5465
Format with black
ajax146 Jun 6, 2026
d120fa1
Migrate automod alert channel
ajax146 Jun 7, 2026
28e5e2f
Migrate some more config items
ajax146 Jun 7, 2026
25bef8a
Process all of dumpdbg and embed, most of duck
ajax146 Jun 7, 2026
5b2ba89
Add embed roles to default/meta
ajax146 Jun 7, 2026
4105f45
Migrate enabled_extenions (mostly)
ajax146 Jun 7, 2026
821ff8d
Rewrite MatchCog
ajax146 Jun 7, 2026
511c524
Rewrite modmail management function
ajax146 Jun 7, 2026
3e2225c
Merge branch 'main' into NewConfigSystem
ajax146 Jun 7, 2026
b60c403
Rewrite LoopCog
ajax146 Jun 7, 2026
1095c3c
Pylint formatting changes
ajax146 Jun 7, 2026
707b33a
Pylint formatting changes 2
ajax146 Jun 7, 2026
945ad52
flake8 formatting changes
ajax146 Jun 7, 2026
ebc5721
Rewrite 2 functions in duck, clear old config system from duck
ajax146 Jun 7, 2026
8555e38
Update docstring in duck
ajax146 Jun 7, 2026
0e16208
Rewrite a bunch of easy functions
ajax146 Jun 7, 2026
f118f51
Rewrite forum channel
ajax146 Jun 7, 2026
6e66249
More config work
ajax146 Jun 7, 2026
8b5e180
Process gate, joke, grab, honeypot and hangman
ajax146 Jun 7, 2026
aab0383
Remove config seutp from joke and honeypot
ajax146 Jun 7, 2026
70d24a9
Process factoids
ajax146 Jun 7, 2026
1961fc4
Remove unused config variables
ajax146 Jun 7, 2026
aac5172
Kanye, Moderator, Modlog and Modmail config migrated
ajax146 Jun 7, 2026
b695cd4
News, Paste, Purge and Report done
ajax146 Jun 7, 2026
54d0ae5
Formatting with pylint
ajax146 Jun 7, 2026
0839334
Formatting with flake8
ajax146 Jun 7, 2026
ec4cb35
Fix typo in docstring
ajax146 Jun 7, 2026
c29db86
Rewrite extension.py
ajax146 Jun 7, 2026
12855f5
Fix some errors in extension register
ajax146 Jun 7, 2026
7a4ff3d
Rewrite config commands
ajax146 Jun 7, 2026
390ebf7
Sort extensions on list disabled
ajax146 Jun 7, 2026
9b955c1
Strip old config system out
ajax146 Jun 7, 2026
674f8e8
Fix some bugs
ajax146 Jun 7, 2026
ed58bca
Docstring updates
ajax146 Jun 7, 2026
9b5dcd3
Fix typo in docstring
ajax146 Jun 7, 2026
e4fb349
Update docstring
ajax146 Jun 7, 2026
3eebe00
Move some functions around
ajax146 Jun 7, 2026
9348e85
Finish migrating config to new system, clear out extensionconfig
ajax146 Jun 7, 2026
eaeee57
A bunch of changes to the config.py system to support future commands
ajax146 Jun 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.env
.venv
config.yml
*.pyc
.vscode
Expand All @@ -8,3 +9,4 @@ __pycache__
.coverage
.hypothesis
.idea/
techsupport_bot/configuration/guild_configs
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ services:
stop_signal: SIGINT
volumes:
- ./config.yml:/var/TechSupportBot/techsupport_bot/config.yml
- ./techsupport_bot/configuration/guild_configs:/var/TechSupportBot/techsupport_bot/configuration/guild_configs
networks:
- all
depends_on:
Expand Down
42 changes: 3 additions & 39 deletions documentation/Extension-howto.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,45 +10,13 @@ async def setup(bot):
```
This code is run when loading the extension, is used to add model classes and config entries.

## Config entries

```py
from core import extensionconfig
config = extensionconfig.ExtensionConfig()
config.add(
key="<key>",
datatype="<datatype",
title="<title>",
description="<description>",
default="<default-value>",
)
```
This defines the config, then defines its values.
The config.json returned by `.config patch` will have the following value added to it:
```json
"<extension-name>": {
"<key>": {
"datatype": "<datatype>",
"title": "<title>",
"description": "<description>",
"default": "<default>",
"value": "<default>"
}
}
```
NOTE: The entry might not automatically get added to the file and will have to be added in manually according to the template above.


## Registering the extension

```py
await bot.add_cog(extension-name(bot=bot))
bot.add_extension_config("extension-name", config)
```
This registers the extension, assumes the extension name is the filename if the `extension_name` argument wasn't supplied.

The second line adds the extension to the config .json file.

## Optional: Postgres

This defines any database models used in this extension.
Expand Down Expand Up @@ -262,14 +230,10 @@ To access the values, you can use the following:
self.bot.file_config.group.subgroup.key
```
---
To access the json config, you can add the following line of code, which loads the guild config file:
```py
config = self.bot.guild_configs[guild_id]
```

Afterwards you can access the values with
To access the config for a given guild, use the "get_config_entry" in the configuration module:
```py
config.extensions.<Ext-name>.<Value-name>.value
import configuration
value = configuration.get_config_entry(guild.id, "config_key")
```

## Calling an API
Expand Down
12 changes: 0 additions & 12 deletions documentation/core/bot.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,6 @@ The bot.py file is the primary file of the program. It contains all of the core

### on_message

## Guild config management functions

### register_new_guild_config

### create_new_context_config

### write_new_config

### add_extension_config

### get_log_channel_from_guild

## File config loading functions

### load_file_config
Expand Down
Loading
Loading