Fixed lazy role position updating due to not making sure that blacklisted id exists in state

This commit is contained in:
Visual 2020-03-30 15:26:04 +00:00
parent 3023404d42
commit b098044a4b
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."""
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(
guild_id, ("GUILD_ROLE_UPDATE", {"guild_id": str(guild_id), "role": role})
@ -170,7 +170,8 @@ def gen_pairs(
}
for blacklisted_id in blacklist:
preferred_state.pop(blacklisted_id)
if blacklisted_id in preferred_state.keys():
preferred_state.pop(blacklisted_id)
# for each change, we must find a matching change
# in the same list, so we can make a swap pair
@ -310,3 +311,4 @@ async def delete_guild_role(guild_id, role_id):
)
return "", 204