From 8f2ad0f33d4d031f7030e2ab633d1a5652784354 Mon Sep 17 00:00:00 2001 From: gabixdev Date: Mon, 3 Dec 2018 01:46:37 +0100 Subject: [PATCH] small fixes --- discord_endpoints.txt | 2 +- litecord/blueprints/guilds.py | 16 +++++++++------- litecord/schemas.py | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/discord_endpoints.txt b/discord_endpoints.txt index d95597e..24744c4 100644 --- a/discord_endpoints.txt +++ b/discord_endpoints.txt @@ -18,7 +18,7 @@ Create Reaction PUT /channels/{channel.id}/messa Create Webhook POST /channels/{channel.id}/webhooks Delete All Reactions DELETE /channels/{channel.id}/messages/{message.id}/reactions Delete Channel Permission DELETE /channels/{channel.id}/permissions/{overwrite.id} -Delete Guild DELETE /guilds/{guild.id} +Delete Guild POST /guilds/{guild.id}/delete Delete Guild Integration DELETE /guilds/{guild.id}/integrations/{integration.id} Delete Guild Role DELETE /guilds/{guild.id}/roles/{role.id} Delete Invite DELETE /invites/{invite.code} diff --git a/litecord/blueprints/guilds.py b/litecord/blueprints/guilds.py index 203e28f..715d314 100644 --- a/litecord/blueprints/guilds.py +++ b/litecord/blueprints/guilds.py @@ -133,9 +133,9 @@ async def create_guild(): # is the same as the id of the guild, and create_role # generates a new snowflake. await app.db.execute(""" - INSERT INTO roles (id, guild_id, name, position, permissions) - VALUES ($1, $2, $3, $4, $5) - """, guild_id, guild_id, '@everyone', 0, DEFAULT_EVERYONE_PERMS) + INSERT INTO roles (id, guild_id, name, position, permissions, color) + VALUES ($1, $2, $3, $4, $5, $6) + """, guild_id, guild_id, '@everyone', 0, DEFAULT_EVERYONE_PERMS, 0) # add the @everyone role to the guild creator await app.db.execute(""" @@ -253,7 +253,7 @@ async def _update_guild(guild_id): return jsonify(guild) -@bp.route('/', methods=['DELETE']) +@bp.route('//delete', methods=['POST']) async def delete_guild(guild_id): """Delete a guild.""" user_id = await token_check() @@ -264,9 +264,11 @@ async def delete_guild(guild_id): WHERE guilds.id = $1 """, guild_id) - await app.dispatcher.dispatch_guild(guild_id, 'GUILD_DELETE', { - 'id': guild_id, - 'unavailable': False, + # Discord's client expects IDs being string + await app.dispatcher.dispatch('guild', guild_id, 'GUILD_DELETE', { + 'guild_id': str(guild_id), + 'id': str(guild_id), + # 'unavailable': False, }) # remove from the dispatcher so nobody diff --git a/litecord/schemas.py b/litecord/schemas.py index cf4c76f..8518dea 100644 --- a/litecord/schemas.py +++ b/litecord/schemas.py @@ -163,7 +163,7 @@ REGISTER = { } REGISTER_WITH_INVITE = {**REGISTER, **{ - 'invcode': {'type': 'string', 'required': True} + 'invite': {'type': 'string', 'required': True} }}