diff --git a/litecord/blueprints/guilds.py b/litecord/blueprints/guilds.py index 02d1bf9..a5b0853 100644 --- a/litecord/blueprints/guilds.py +++ b/litecord/blueprints/guilds.py @@ -297,13 +297,20 @@ async def _update_guild(guild_id): await _guild_update_icon("banner", guild_id, j["banner"]) + if to_update(j, guild, "discovery_splash"): + if not await app.storage.has_feature(guild_id, "PUBLIC"): + raise BadRequest("guild does not have PUBLIC feature") + + await _guild_update_icon("discovery_splash", guild_id, j["discovery_splash"]) + fields = [ "verification_level", "default_message_notifications", "explicit_content_filter", "afk_timeout", "description", - "preferred_locale" + "preferred_locale", + "discovery_splash" ] for field in [f for f in fields if f in j]: diff --git a/litecord/schemas.py b/litecord/schemas.py index 4a8cc04..7134007 100644 --- a/litecord/schemas.py +++ b/litecord/schemas.py @@ -295,6 +295,7 @@ GUILD_UPDATE = { "rules_channel_id": {"type": "snowflake", "required": False, "nullable": True}, "public_updates_channel_id": {"type": "snowflake", "required": False, "nullable": True}, "preferred_locale": {"type": "string", "required": False, "nullable": True}, + "discovery_splash": {"type": "string", "required": False, "nullable": True}, } diff --git a/litecord/storage.py b/litecord/storage.py index 76eae62..6d70f99 100644 --- a/litecord/storage.py +++ b/litecord/storage.py @@ -202,7 +202,7 @@ class Storage: embed_enabled, embed_channel_id::text, widget_enabled, widget_channel_id::text, system_channel_id::text, rules_channel_id::text, public_updates_channel_id::text, features, - banner, description, preferred_locale + banner, description, preferred_locale, discovery_splash FROM guilds WHERE guilds.id = $1 """, diff --git a/manage/cmd/migration/scripts/8_add_discovery_splash.sql b/manage/cmd/migration/scripts/8_add_discovery_splash.sql new file mode 100644 index 0000000..405b864 --- /dev/null +++ b/manage/cmd/migration/scripts/8_add_discovery_splash.sql @@ -0,0 +1 @@ +ALTER TABLE guilds ADD COLUMN discovery_splash text; \ No newline at end of file