aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Amrou Bellalouna <[email protected]>2023-03-09 19:00:51 +0100
committerGravatar GitHub <[email protected]>2023-03-09 18:00:51 +0000
commitc6f9eb9480c3dc8a74aac4ab83af0bdd1a50facc (patch)
treec769f5aae448fadd38391bd303869c1a90f8eb57
parentMerge pull request #2458 from shtlrs/add-botstrap-dep-group-and-task (diff)
Merge #2459: Update nested delimiter to double underscore
* change nested delimiter to double underscore * write channel_id along with the webhook_id * make channel mandatory for webhook
-rw-r--r--bot/constants.py5
-rw-r--r--botstrap.py3
2 files changed, 4 insertions, 4 deletions
diff --git a/bot/constants.py b/bot/constants.py
index 6a08e02ff..a4d5761be 100644
--- a/bot/constants.py
+++ b/bot/constants.py
@@ -20,6 +20,7 @@ class EnvConfig(BaseSettings):
class Config:
env_file = ".env", ".env.server",
env_file_encoding = 'utf-8'
+ env_nested_delimiter = '__'
class _Miscellaneous(EnvConfig):
@@ -257,12 +258,11 @@ class ThreadArchiveTimes(Enum):
class Webhook(BaseModel):
id: int
- channel: Optional[int]
+ channel: int
class _Webhooks(EnvConfig):
EnvConfig.Config.env_prefix = "webhooks_"
- EnvConfig.Config.env_nested_delimiter = '_'
big_brother: Webhook = Webhook(id=569133704568373283, channel=Channels.big_brother)
dev_log: Webhook = Webhook(id=680501655111729222, channel=Channels.dev_log)
@@ -364,7 +364,6 @@ class Rules(BaseModel):
class _AntiSpam(EnvConfig):
EnvConfig.Config.env_prefix = 'anti_spam_'
- EnvConfig.Config.env_nested_delimiter = '_'
cache_size = 100
diff --git a/botstrap.py b/botstrap.py
index 2b34dad81..28486bd36 100644
--- a/botstrap.py
+++ b/botstrap.py
@@ -159,6 +159,7 @@ with DiscordClient() as discord_client:
webhook_id = create_webhook(webhook_name, webhook_channel_id, client=discord_client)
else:
webhook_id = webhook_model.id
- config_str += f"webhooks_{webhook_name}_id={webhook_id}\n"
+ config_str += f"webhooks_{webhook_name}__id={webhook_id}\n"
+ config_str += f"webhooks_{webhook_name}__channel={all_channels[webhook_name]}\n"
env_file_path.write_text(config_str)