Merge branch 'master' into 'master'

some fixes

See merge request luna/litecord!6
This commit is contained in:
Luna Mendes 2018-12-03 01:17:00 +00:00
commit 3fbaf15c1a
3 changed files with 11 additions and 8 deletions

View File

@ -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}

View File

@ -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("""
@ -254,6 +254,7 @@ async def _update_guild(guild_id):
@bp.route('/<int:guild_id>', methods=['DELETE'])
@bp.route('/<int:guild_id>/delete', methods=['POST']) # this one is not actually documented, but it's used by Discord client
async def delete_guild(guild_id):
"""Delete a guild."""
user_id = await token_check()
@ -264,9 +265,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

View File

@ -163,7 +163,7 @@ REGISTER = {
}
REGISTER_WITH_INVITE = {**REGISTER, **{
'invcode': {'type': 'string', 'required': True}
'invite': {'type': 'string', 'required': True}
}}