From d16a893d84bc66b65786e5b04fd43b43d098fc71 Mon Sep 17 00:00:00 2001 From: Luna Date: Sun, 29 Aug 2021 22:59:18 -0300 Subject: [PATCH] fix nick updates on lazy guilds --- litecord/pubsub/lazy_guild.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/litecord/pubsub/lazy_guild.py b/litecord/pubsub/lazy_guild.py index ac7835d..ae6b865 100644 --- a/litecord/pubsub/lazy_guild.py +++ b/litecord/pubsub/lazy_guild.py @@ -1072,10 +1072,19 @@ class GuildMemberList: # update our presence with the given partial presence # since in both cases we'd update it anyways self.list.presences[user_id].update(partial_presence) + + # TODO: refactor presence semantics. what will partial_presence + # actually have? this is a hack to make nicks work. + if has_nick: + self.list.members[user_id]["nick"] = partial_presence["nick"] + self.list.members[user_id]["roles"] = roles # if we're going to the same group AND there are no # nickname changes, treat this as a simple update + # + # nickname changes CAN trigger index changes in a list because + # all nicks are ordered alphabetically. that's why it isn't simple. if old_group == new_group and not has_nick: return await self._pres_update_simple(user_id) elif new_group is None: