diff --git a/discord/member.py b/discord/member.py index 753780d9d..62bdbfcc2 100644 --- a/discord/member.py +++ b/discord/member.py @@ -262,17 +262,6 @@ class Member(discord.abc.Messageable, _BaseUser): member_data['user'] = data return cls(data=member_data, guild=guild, state=state) - @classmethod - def _from_presence_update(cls, *, data, guild, state): - clone = cls(data=data, guild=guild, state=state) - to_return = cls(data=data, guild=guild, state=state) - to_return._client_status = { - sys.intern(key): sys.intern(value) - for key, value in data.get('client_status', {}).items() - } - to_return._client_status[None] = sys.intern(data['status']) - return to_return, clone - @classmethod def _copy(cls, member): self = cls.__new__(cls) # to bypass __init__ diff --git a/discord/state.py b/discord/state.py index d35ff7df5..fc6974d17 100644 --- a/discord/state.py +++ b/discord/state.py @@ -602,17 +602,13 @@ class ConnectionState: member_id = int(user['id']) member = guild.get_member(member_id) if member is None: - if 'username' not in user: - # sometimes we receive 'incomplete' member data post-removal. - # skip these useless cases. - return + log.debug('PRESENCE_UPDATE referencing an unknown member ID: %s. Discarding', member_id) + return - member, old_member = Member._from_presence_update(guild=guild, data=data, state=self) - else: - old_member = Member._copy(member) - user_update = member._presence_update(data=data, user=user) - if user_update: - self.dispatch('user_update', user_update[0], user_update[1]) + old_member = Member._copy(member) + user_update = member._presence_update(data=data, user=user) + if user_update: + self.dispatch('user_update', user_update[0], user_update[1]) self.dispatch('member_update', old_member, member)