diff options
| author | Rapptz <[email protected]> | 2020-08-26 07:49:43 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2020-09-23 03:20:35 -0400 |
| commit | 9036b9651b147c78ffcde211ecf458dceb48a8aa (patch) | |
| tree | 7645d841cec2cbb4353932956582884d90e1281d | |
| parent | Fix issues with VoiceProtocol docstrsings. (diff) | |
| download | discord.py-9036b9651b147c78ffcde211ecf458dceb48a8aa.tar.xz discord.py-9036b9651b147c78ffcde211ecf458dceb48a8aa.zip | |
Properly handle disconnects in voice when force disconnected
| -rw-r--r-- | discord/voice_client.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/discord/voice_client.py b/discord/voice_client.py index a48a92d1..a16aaf41 100644 --- a/discord/voice_client.py +++ b/discord/voice_client.py @@ -96,7 +96,7 @@ class VoiceProtocol: The raw `voice state payload`__. .. _voice_state_update_payload: https://discord.com/developers/docs/resources/voice#voice-state-object - + __ voice_state_update_payload_ """ raise NotImplementedError @@ -252,8 +252,12 @@ class VoiceClient(VoiceProtocol): if not self._handshaking: # If we're done handshaking then we just need to update ourselves - guild = self.guild - self.channel = channel_id and guild and guild.get_channel(int(channel_id)) + if channel_id is None: + # We're being disconnected so cleanup + await self.disconnect() + else: + guild = self.guild + self.channel = channel_id and guild and guild.get_channel(int(channel_id)) else: self._voice_state_complete.set() |