mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
voice: fix receiver null on immediate voiceStateUpdate
This commit is contained in:
@@ -113,7 +113,7 @@ class VoiceConnection extends EventEmitter {
|
||||
* The voice receiver of this connection
|
||||
* @type {VoiceReceiver}
|
||||
*/
|
||||
this.receiver = null;
|
||||
this.receiver = new VoiceReceiver(this);
|
||||
|
||||
this.authenticate();
|
||||
}
|
||||
@@ -418,7 +418,6 @@ class VoiceConnection extends EventEmitter {
|
||||
Object.assign(this.authentication, data);
|
||||
this.status = VoiceStatus.CONNECTED;
|
||||
clearTimeout(this.connectTimeout);
|
||||
this.receiver = new VoiceReceiver(this);
|
||||
/**
|
||||
* Emitted once the connection is ready, when a promise to join a voice channel resolves,
|
||||
* the connection will already be ready.
|
||||
|
||||
@@ -108,6 +108,8 @@ class VoiceConnectionUDPClient extends EventEmitter {
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
socket.on('message', buffer => this.voiceConnection.receiver.packets.push(buffer));
|
||||
});
|
||||
|
||||
const blankMessage = Buffer.alloc(70);
|
||||
|
||||
@@ -21,7 +21,6 @@ class VoiceReceiver extends EventEmitter {
|
||||
* @param {Error|string} error The error or message to debug
|
||||
*/
|
||||
this.packets.on('error', err => this.emit('debug', err));
|
||||
this.connection.sockets.udp.socket.on('message', buffer => this.packets.push(buffer));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user