aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2016-05-20 19:22:22 -0400
committerRapptz <[email protected]>2016-05-20 19:22:22 -0400
commitbf650297a1f67cf43374b7fb81502c774f99fbd0 (patch)
tree3aef3c5598af79ed43e6cc984d26693c1f16d349
parentFix bug where members leaving will stay in Channel.voice_members. (diff)
downloaddiscord.py-bf650297a1f67cf43374b7fb81502c774f99fbd0.tar.xz
discord.py-bf650297a1f67cf43374b7fb81502c774f99fbd0.zip
Only trigger on_voice_state_update if the member actually exists.
-rw-r--r--discord/state.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/discord/state.py b/discord/state.py
index b28529db..7c1ba993 100644
--- a/discord/state.py
+++ b/discord/state.py
@@ -521,8 +521,9 @@ class ConnectionState:
if voice is not None:
voice.channel = server.get_channel(data.get('channel_id'))
- updated_members = server._update_voice_state(data)
- self.dispatch('voice_state_update', *updated_members)
+ before, after = server._update_voice_state(data)
+ if after is not None:
+ self.dispatch('voice_state_update', before, after)
def parse_typing_start(self, data):
channel = self.get_channel(data.get('channel_id'))