Add discovery_splash

This commit is contained in:
George Tsatsis 2020-03-31 01:11:57 +03:00
parent 4ff1916ebe
commit d786edffec
No known key found for this signature in database
GPG Key ID: 71F5AD643ABD99A4
4 changed files with 11 additions and 2 deletions

View File

@ -297,13 +297,20 @@ async def _update_guild(guild_id):
await _guild_update_icon("banner", guild_id, j["banner"]) 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 = [ fields = [
"verification_level", "verification_level",
"default_message_notifications", "default_message_notifications",
"explicit_content_filter", "explicit_content_filter",
"afk_timeout", "afk_timeout",
"description", "description",
"preferred_locale" "preferred_locale",
"discovery_splash"
] ]
for field in [f for f in fields if f in j]: for field in [f for f in fields if f in j]:

View File

@ -295,6 +295,7 @@ GUILD_UPDATE = {
"rules_channel_id": {"type": "snowflake", "required": False, "nullable": True}, "rules_channel_id": {"type": "snowflake", "required": False, "nullable": True},
"public_updates_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}, "preferred_locale": {"type": "string", "required": False, "nullable": True},
"discovery_splash": {"type": "string", "required": False, "nullable": True},
} }

View File

@ -202,7 +202,7 @@ class Storage:
embed_enabled, embed_channel_id::text, embed_enabled, embed_channel_id::text,
widget_enabled, widget_channel_id::text, widget_enabled, widget_channel_id::text,
system_channel_id::text, rules_channel_id::text, public_updates_channel_id::text, features, 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 FROM guilds
WHERE guilds.id = $1 WHERE guilds.id = $1
""", """,

View File

@ -0,0 +1 @@
ALTER TABLE guilds ADD COLUMN discovery_splash text;