From 21ed9f61d2b2f44c0cd43fecbb7f1ea77f920596 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Sat, 17 Oct 2020 21:56:56 -0400 Subject: Fix disconnect when trying to move to another voice channel. Not overly proud of this implementation but this allows the library to differentiate between a 4014 that means "move to another channel" or "move nowhere". Sometimes the VOICE_STATE_UPDATE comes before the actual websocket disconnect so special care had to be taken in that case. Fix #5904 --- discord/gateway.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'discord/gateway.py') diff --git a/discord/gateway.py b/discord/gateway.py index 92fa4f56..b0354489 100644 --- a/discord/gateway.py +++ b/discord/gateway.py @@ -719,6 +719,7 @@ class DiscordVoiceWebSocket: self.loop = loop self._keep_alive = None self._close_code = None + self.secret_key = None async def send_as_json(self, data): log.debug('Sending voice websocket frame: %s.', data) @@ -872,7 +873,7 @@ class DiscordVoiceWebSocket: async def load_secret_key(self, data): log.info('received secret key for voice connection') - self._connection.secret_key = data.get('secret_key') + self.secret_key = self._connection.secret_key = data.get('secret_key') await self.speak() await self.speak(False) -- cgit v1.2.3