From 5c0dfcc9b1a636de3cd625b0b863653f6524c501 Mon Sep 17 00:00:00 2001 From: Luna Date: Fri, 15 Mar 2019 04:39:09 -0300 Subject: [PATCH] guilds: add support for icon hash for j.splash - guilds: fix guild icon being set to j.splash - schemas: handle splash being icon hash --- litecord/blueprints/guilds.py | 10 +++++----- litecord/schemas.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/litecord/blueprints/guilds.py b/litecord/blueprints/guilds.py index ebdca11..c4675b8 100644 --- a/litecord/blueprints/guilds.py +++ b/litecord/blueprints/guilds.py @@ -286,17 +286,17 @@ async def _update_guild(guild_id): if 'icon' in j: await _guild_update_icon( - 'guild', guild_id, j['splash'], size=(128, 128)) + 'guild', guild_id, j['icon'], size=(128, 128)) - if 'splash' in j: + # small guild to work with to_update() + guild = await app.storage.get_guild(guild_id) + + if to_update(j, guild, 'splash'): if not await app.storage.has_feature(guild_id, 'INVITE_SPLASH'): raise BadRequest('guild does not have INVITE_SPLASH feature') await _guild_update_icon('splash', guild_id, j['splash']) - # small guild to work with to_update() - guild = await app.storage.get_guild(guild_id) - if to_update(j, guild, 'banner'): if not await app.storage.has_feature(guild_id, 'VERIFIED'): raise BadRequest('guild is not verified') diff --git a/litecord/schemas.py b/litecord/schemas.py index 6796ed8..c52cf8f 100644 --- a/litecord/schemas.py +++ b/litecord/schemas.py @@ -280,11 +280,11 @@ GUILD_UPDATE = { 'region': {'type': 'voice_region', 'required': False, 'nullable': True}, 'icon': {'type': 'b64_icon', 'required': False, 'nullable': True}, - 'splash': {'type': 'b64_icon', 'required': False, 'nullable': True}, # TODO: does splash also respect when its just a string pointing to the # hash, just like in USER_UPDATE.avatar? 'banner': {'type': 'string', 'required': False, 'nullable': True}, + 'splash': {'type': 'string', 'required': False, 'nullable': True}, 'description': { 'type': 'string', 'required': False,