guilds: handle when j.icon is not present when creating guild

This commit is contained in:
Luna 2019-02-07 15:43:16 -03:00
parent c71a75dd3d
commit 27a7c7e8ef
1 changed files with 6 additions and 2 deletions

View File

@ -128,7 +128,11 @@ async def create_guild():
guild_id = get_snowflake() guild_id = get_snowflake()
image = await put_guild_icon(guild_id, j['icon']) if 'icon' in j:
image = await put_guild_icon(guild_id, j['icon'])
image = image.icon_hash
else:
image = None
await app.db.execute( await app.db.execute(
""" """
@ -136,7 +140,7 @@ async def create_guild():
verification_level, default_message_notifications, verification_level, default_message_notifications,
explicit_content_filter) explicit_content_filter)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8) VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
""", guild_id, j['name'], j['region'], image.icon_hash, user_id, """, guild_id, j['name'], j['region'], image, user_id,
j.get('verification_level', 0), j.get('verification_level', 0),
j.get('default_message_notifications', 0), j.get('default_message_notifications', 0),
j.get('explicit_content_filter', 0)) j.get('explicit_content_filter', 0))