Pull request #2: Fixed lazy role position updating due to not making sure that blacklisted id exists in state

Merge in LIT/litecord from visual/rolespy-1585581892324 to bugfix/lazy-role-update

* commit 'b098044a4b03463a6162efb4073a7ed42a3f3762':
  Fixed lazy role position updating due to not making sure that blacklisted id exists in state
This commit is contained in:
George Tsatsis 2020-03-30 15:26:55 +00:00
commit 2629e2a725
1 changed files with 4 additions and 2 deletions

View File

@ -65,7 +65,7 @@ async def _role_update_dispatch(role_id: int, guild_id: int):
"""Dispatch a GUILD_ROLE_UPDATE with updated information on a role.""" """Dispatch a GUILD_ROLE_UPDATE with updated information on a role."""
role = await app.storage.get_role(role_id, guild_id) role = await app.storage.get_role(role_id, guild_id)
await maybe_lazy_guild_dispatch(guild_id, "role_pos_upd", role) await maybe_lazy_guild_dispatch(guild_id, "role_position_update", role)
await app.dispatcher.guild.dispatch( await app.dispatcher.guild.dispatch(
guild_id, ("GUILD_ROLE_UPDATE", {"guild_id": str(guild_id), "role": role}) guild_id, ("GUILD_ROLE_UPDATE", {"guild_id": str(guild_id), "role": role})
@ -170,6 +170,7 @@ def gen_pairs(
} }
for blacklisted_id in blacklist: for blacklisted_id in blacklist:
if blacklisted_id in preferred_state.keys():
preferred_state.pop(blacklisted_id) preferred_state.pop(blacklisted_id)
# for each change, we must find a matching change # for each change, we must find a matching change
@ -310,3 +311,4 @@ async def delete_guild_role(guild_id, role_id):
) )
return "", 204 return "", 204