Skip to content
This repository has been archived by the owner on Aug 1, 2021. It is now read-only.

Commit

Permalink
[bugfix] handle stale presences correctly
Browse files Browse the repository at this point in the history
It's possible for Discord to send us presences for users which do not
actually exist in the Guild (remember; eventually consistent), so we
should throw these away when we get them.
  • Loading branch information
b1naryth1ef committed Jul 10, 2017
1 parent c4331da commit 5aa5e63
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion disco/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ def on_guild_create(self, event):
self.users[member.user.id] = member.user

for presence in event.presences:
self.users[presence.user.id].presence = presence
if presence.user.id in self.users:
self.users[presence.user.id].presence = presence

for voice_state in six.itervalues(event.guild.voice_states):
self.voice_states[voice_state.session_id] = voice_state
Expand Down

0 comments on commit 5aa5e63

Please sign in to comment.