Fix voice websocket not being closed before being replaced

This commit is contained in:
Imayhaveborkedit 2023-08-04 19:12:59 -04:00 committed by Rapptz
parent 506947568c
commit c5f5f8eb87

View File

@ -421,6 +421,11 @@ class VoiceClient(VoiceProtocol):
self.finish_handshake()
self._potentially_reconnecting = False
if self.ws:
_log.debug("Closing existing voice websocket")
await self.ws.close()
try:
self.ws = await self.connect_websocket()
except (ConnectionClosed, asyncio.TimeoutError):