From 83721d45258291abc22753e8f10cc9163a22e52b Mon Sep 17 00:00:00 2001 From: George Tsatsis Date: Mon, 30 Mar 2020 20:33:08 +0300 Subject: [PATCH 1/4] Fix server update problems (string where supposed to be int) --- litecord/blueprints/guilds.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litecord/blueprints/guilds.py b/litecord/blueprints/guilds.py index 546fe01..ec331c6 100644 --- a/litecord/blueprints/guilds.py +++ b/litecord/blueprints/guilds.py @@ -346,7 +346,7 @@ async def _update_guild(guild_id): SET {field} = $1 WHERE id = $2 """, - j[field], + int(j[field]), guild_id, ) From 324cf6d4fac1cb0fb0f7e82a4843d1e321aee283 Mon Sep 17 00:00:00 2001 From: George Tsatsis Date: Mon, 30 Mar 2020 20:57:29 +0300 Subject: [PATCH 2/4] Create rules channel --- litecord/blueprints/guilds.py | 4 ++-- litecord/storage.py | 2 +- manage/cmd/migration/scripts/5_add_rules_channel_id.sql | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 manage/cmd/migration/scripts/5_add_rules_channel_id.sql diff --git a/litecord/blueprints/guilds.py b/litecord/blueprints/guilds.py index ec331c6..74ea3e8 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"] + channel_fields = ["afk_channel_id", "system_channel_id", "rules_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 channel + # setting to null should remove the link between the afk/sys/rules channel # to the guild. if j[field] is None: await app.db.execute( diff --git a/litecord/storage.py b/litecord/storage.py index 4c22980..8bf3586 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, features, + system_channel_id::text, rules_channel_id::text, features, banner, description FROM guilds WHERE guilds.id = $1 diff --git a/manage/cmd/migration/scripts/5_add_rules_channel_id.sql b/manage/cmd/migration/scripts/5_add_rules_channel_id.sql new file mode 100644 index 0000000..efb74bb --- /dev/null +++ b/manage/cmd/migration/scripts/5_add_rules_channel_id.sql @@ -0,0 +1 @@ +ALTER TABLE guilds ADD COLUMN rules_channel_id int \ No newline at end of file From 93958a0943f964ffc4a09e1b3e60a63d8149f64b Mon Sep 17 00:00:00 2001 From: George Tsatsis Date: Mon, 30 Mar 2020 21:02:20 +0300 Subject: [PATCH 3/4] add rules_channel_id to schemas --- litecord/schemas.py | 1 + 1 file changed, 1 insertion(+) diff --git a/litecord/schemas.py b/litecord/schemas.py index 1d65837..2e88661 100644 --- a/litecord/schemas.py +++ b/litecord/schemas.py @@ -292,6 +292,7 @@ GUILD_UPDATE = { "owner_id": {"type": "snowflake", "required": False}, "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}, } From d9940b9d3f2c305fc2737643a1f153515e64d48c Mon Sep 17 00:00:00 2001 From: George Tsatsis Date: Mon, 30 Mar 2020 21:07:17 +0300 Subject: [PATCH 4/4] Make rules_channel_id a bigint --- manage/cmd/migration/scripts/5_add_rules_channel_id.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manage/cmd/migration/scripts/5_add_rules_channel_id.sql b/manage/cmd/migration/scripts/5_add_rules_channel_id.sql index efb74bb..1ea4c9e 100644 --- a/manage/cmd/migration/scripts/5_add_rules_channel_id.sql +++ b/manage/cmd/migration/scripts/5_add_rules_channel_id.sql @@ -1 +1 @@ -ALTER TABLE guilds ADD COLUMN rules_channel_id int \ No newline at end of file +ALTER TABLE guilds ADD COLUMN rules_channel_id bigint \ No newline at end of file