aboutsummaryrefslogtreecommitdiff
path: root/discord/gateway.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2020-10-17 21:56:56 -0400
committerRapptz <[email protected]>2020-10-17 22:01:57 -0400
commit21ed9f61d2b2f44c0cd43fecbb7f1ea77f920596 (patch)
treeccbf20d5fa6bfd941b4590192364c8f21ce33cbd /discord/gateway.py
parentMark intent alias flags as actual aliases to skip them in __iter__ (diff)
downloaddiscord.py-21ed9f61d2b2f44c0cd43fecbb7f1ea77f920596.tar.xz
discord.py-21ed9f61d2b2f44c0cd43fecbb7f1ea77f920596.zip
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
Diffstat (limited to 'discord/gateway.py')
-rw-r--r--discord/gateway.py3
1 files changed, 2 insertions, 1 deletions
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)