Merged
Conversation
Supported features: * Enable community server * Categories * Channels * Text channel topics * Forum channel guidelines * Forum channel tags
Contributor
Author
|
@egeakman Thank you :) After #205 is merged, I'd like to move this code into the main project and split it into multple files (model, configurator, bot, config). I prefer to have all configuration for one thing (e.g. server setup) in one place. What would be the benefit of spreading the configuration across multiple files? |
Contributor
Author
|
Force-merged without review to move forward with the Prod server. If anyone has feedback or ideas, please don't hesitate to reach out! :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This script runs a Discord bot which will configure all connected guilds according to the provided configuration and then stops itself.
Benefits
This infrastructure-as-code approach has the following benefits compared to the current manual approach:
Next Steps
At a later stage, we might want to create a GH Action to run this script with a single click.
Functionality
All updates are idempotent: If no update is required, no change is performed on the server.
Supported:
<<#CHANNEL-NAME>>and<<@&ROLE-NAME>>Most changes are non-destructive:
Testing
I tested the script on an empty, a semi-configured, and a fully configured server. The servers were configured as expected during the first execution, and no modifications were performed during the second execution.
About the implementation
Structure
The script has four parts:
pydantic.BaseModelsubclass)argparseprogram to execute the configuration)Line Count
I know this is a long file. I considered two approaches to make it less daunting, but found both unsatisfactory.
1. Store the model instance in a .json or .toml file
I tested this, and found the .json and .toml files harder to understand and modify than the Python classes.
This is mainly for these:
\ncharacters is much more inconvenient compared to Python's multi-line strings.We can revisit this later with minimal effort.
2. Split the code into multiple .py files
I tested this, and found that the effort did not outweigh the costs:
python file.py.sys.path, or to create a package.We can revisit this later. We will restructure the bot package in the next months anyway, and sub-apps like this one would fit in well.