mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
Fixes disconnecting VoiceConnections before connected (#1227)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user