diff options
| author | CraftSpider <[email protected]> | 2018-12-01 22:45:37 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2018-12-14 18:59:28 -0500 |
| commit | 068d953b42cbcb31db0d12a52842171223f8895d (patch) | |
| tree | 05f39a0a22f954e5c38f032f276c8f90d1a6c1a9 | |
| parent | Fix AttributeError in webhook.send (diff) | |
| download | discord.py-068d953b42cbcb31db0d12a52842171223f8895d.tar.xz discord.py-068d953b42cbcb31db0d12a52842171223f8895d.zip | |
Add override to `close()` method to the websocket subclass.
This makes it so that _keep_alive is stopped no matter which closing
method is called
| -rw-r--r-- | discord/gateway.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/discord/gateway.py b/discord/gateway.py index 35d92fe6..803c8c25 100644 --- a/discord/gateway.py +++ b/discord/gateway.py @@ -510,6 +510,12 @@ class DiscordWebSocket(websockets.client.WebSocketClientProtocol): log.debug('Updating our voice state to %s.', payload) await self.send_as_json(payload) + async def close(self, code=1000, reason=''): + if self._keep_alive: + self._keep_alive.stop() + + await super().close(code, reason) + async def close_connection(self, *args, **kwargs): if self._keep_alive: self._keep_alive.stop() |