diff options
| author | Rapptz <[email protected]> | 2016-06-01 05:20:22 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2016-06-01 05:20:22 -0400 |
| commit | 8638ff44142219e45c565e2b4871a7471b403297 (patch) | |
| tree | 0552d65a8709e088ba6d19c46909d693b9531bd5 | |
| parent | Add RESUME support. (diff) | |
| download | discord.py-8638ff44142219e45c565e2b4871a7471b403297.tar.xz discord.py-8638ff44142219e45c565e2b4871a7471b403297.zip | |
Update voice client main ws references when reconnecting.
| -rw-r--r-- | discord/gateway.py | 2 | ||||
| -rw-r--r-- | discord/state.py | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/discord/gateway.py b/discord/gateway.py index 928e37be..4d2c9cca 100644 --- a/discord/gateway.py +++ b/discord/gateway.py @@ -199,6 +199,8 @@ class DiscordWebSocket(websockets.client.WebSocketClientProtocol): ws._dispatch = client.dispatch ws.gateway = gateway + client.connection._update_references(ws) + log.info('Created websocket connected to {}'.format(gateway)) if not resume: yield from ws.identify() diff --git a/discord/state.py b/discord/state.py index 634a2749..268af188 100644 --- a/discord/state.py +++ b/discord/state.py @@ -107,6 +107,10 @@ class ConnectionState: def _remove_voice_client(self, guild_id): self._voice_clients.pop(guild_id, None) + def _update_references(self, ws): + for vc in self.voice_clients: + vc.main_ws = ws + @property def servers(self): return self._servers.values() |