mirror of
https://github.com/danbulant/discord.js
synced 2026-05-25 13:02:38 +00:00
Fixes disconnecting VoiceConnections before connected (#1227)
This commit is contained in:
parent
f3a7f59824
commit
275c9953a0
1 changed files with 12 additions and 5 deletions
|
|
@ -311,11 +311,18 @@ class VoiceConnection extends EventEmitter {
|
|||
*/
|
||||
cleanup() {
|
||||
const { ws, udp } = this.sockets;
|
||||
ws.removeAllListeners('error');
|
||||
udp.removeAllListeners('error');
|
||||
ws.removeAllListeners('ready');
|
||||
ws.removeAllListeners('sessionDescription');
|
||||
ws.removeAllListeners('speaking');
|
||||
|
||||
if (ws) {
|
||||
ws.removeAllListeners('error');
|
||||
ws.removeAllListeners('ready');
|
||||
ws.removeAllListeners('sessionDescription');
|
||||
ws.removeAllListeners('speaking');
|
||||
}
|
||||
|
||||
if (udp) {
|
||||
udp.removeAllListeners('error');
|
||||
}
|
||||
|
||||
this.sockets.ws = null;
|
||||
this.sockets.udp = null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue