aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2017-04-26 04:52:49 -0400
committerRapptz <[email protected]>2017-04-26 04:52:49 -0400
commit92d55077aa74c783e4731f4e03d4654ff9c6f5f9 (patch)
treed8a7dd88ccbed3514b0fe8bc2bc9a0097229654b
parent[commands] Fix lack of space in when_mentioned (diff)
downloaddiscord.py-92d55077aa74c783e4731f4e03d4654ff9c6f5f9.tar.xz
discord.py-92d55077aa74c783e4731f4e03d4654ff9c6f5f9.zip
Don't set VoiceClient.channel to None when VOICE_STATE_UPDATE says so.
Sometimes VOICE_STATE_UPDATE gives us a channel_id: null payload and we would end up clearing the VoiceClient.channel state along with it.
-rw-r--r--discord/state.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/discord/state.py b/discord/state.py
index 8cd96ee1..6ac83bd1 100644
--- a/discord/state.py
+++ b/discord/state.py
@@ -674,7 +674,9 @@ class ConnectionState:
if int(data['user_id']) == self.user.id:
voice = self._get_voice_client(guild.id)
if voice is not None:
- voice.channel = guild.get_channel(channel_id)
+ ch = guild.get_channel(channel_id)
+ if ch is not None:
+ voice.channel = ch
member, before, after = guild._update_voice_state(data, channel_id)
if after is not None: