From 92489d0f438796654915e49b9a37c7de2d985f50 Mon Sep 17 00:00:00 2001 From: George Tsatsis Date: Mon, 30 Mar 2020 22:19:12 +0300 Subject: [PATCH] Add public updates channel (to server, not channel type) --- litecord/blueprints/guilds.py | 4 ++-- litecord/schemas.py | 1 + litecord/storage.py | 2 +- .../cmd/migration/scripts/6_add_public_updates_channel_id.sql | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 manage/cmd/migration/scripts/6_add_public_updates_channel_id.sql diff --git a/litecord/blueprints/guilds.py b/litecord/blueprints/guilds.py index 74ea3e8..e1b9a39 100644 --- a/litecord/blueprints/guilds.py +++ b/litecord/blueprints/guilds.py @@ -316,9 +316,9 @@ async def _update_guild(guild_id): guild_id, ) - channel_fields = ["afk_channel_id", "system_channel_id", "rules_channel_id"] + channel_fields = ["afk_channel_id", "system_channel_id", "rules_channel_id", "public_updates_channel_id"] for field in [f for f in channel_fields if f in j]: - # setting to null should remove the link between the afk/sys/rules channel + # setting to null should remove the link between the afk/sys/rules/public updates channel # to the guild. if j[field] is None: await app.db.execute( diff --git a/litecord/schemas.py b/litecord/schemas.py index 2e88661..8cf9b09 100644 --- a/litecord/schemas.py +++ b/litecord/schemas.py @@ -293,6 +293,7 @@ GUILD_UPDATE = { "system_channel_id": {"type": "snowflake", "required": False, "nullable": True}, "features": {"type": "list", "required": False, "schema": {"type": "string"}}, "rules_channel_id": {"type": "snowflake", "required": False, "nullable": True}, + "public_updates_channel_id": {"type": "snowflake", "required": False, "nullable": True}, } diff --git a/litecord/storage.py b/litecord/storage.py index 8bf3586..e91bc58 100644 --- a/litecord/storage.py +++ b/litecord/storage.py @@ -201,7 +201,7 @@ class Storage: explicit_content_filter, mfa_level, embed_enabled, embed_channel_id::text, widget_enabled, widget_channel_id::text, - system_channel_id::text, rules_channel_id::text, features, + system_channel_id::text, rules_channel_id::text, public_updates_channel_id::text, features, banner, description FROM guilds WHERE guilds.id = $1 diff --git a/manage/cmd/migration/scripts/6_add_public_updates_channel_id.sql b/manage/cmd/migration/scripts/6_add_public_updates_channel_id.sql new file mode 100644 index 0000000..a26bf17 --- /dev/null +++ b/manage/cmd/migration/scripts/6_add_public_updates_channel_id.sql @@ -0,0 +1 @@ +ALTER TABLE guilds ADD COLUMN public_updates_channel_id bigint \ No newline at end of file