mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 20:13:30 +01:00
fix: regression (changing voice servers)
This commit is contained in:
@@ -452,8 +452,7 @@ class VoiceConnection extends EventEmitter {
|
|||||||
onSessionDescription(data) {
|
onSessionDescription(data) {
|
||||||
Object.assign(this.authentication, data);
|
Object.assign(this.authentication, data);
|
||||||
this.status = VoiceStatus.CONNECTED;
|
this.status = VoiceStatus.CONNECTED;
|
||||||
const dispatcher = this.play(new SingleSilence(), { type: 'opus' });
|
const ready = () => {
|
||||||
dispatcher.on('finish', () => {
|
|
||||||
this.client.clearTimeout(this.connectTimeout);
|
this.client.clearTimeout(this.connectTimeout);
|
||||||
this.emit('debug', `Ready with authentication details: ${JSON.stringify(this.authentication)}`);
|
this.emit('debug', `Ready with authentication details: ${JSON.stringify(this.authentication)}`);
|
||||||
/**
|
/**
|
||||||
@@ -462,7 +461,14 @@ class VoiceConnection extends EventEmitter {
|
|||||||
* @event VoiceConnection#ready
|
* @event VoiceConnection#ready
|
||||||
*/
|
*/
|
||||||
this.emit('ready');
|
this.emit('ready');
|
||||||
});
|
};
|
||||||
|
if (this.dispatcher) {
|
||||||
|
ready();
|
||||||
|
} else {
|
||||||
|
// This serves to provide support for voice receive, sending audio is required to receive it.
|
||||||
|
const dispatcher = this.play(new SingleSilence(), { type: 'opus' });
|
||||||
|
dispatcher.once('finish', ready);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onStartSpeaking({ user_id, ssrc, speaking }) {
|
onStartSpeaking({ user_id, ssrc, speaking }) {
|
||||||
|
|||||||
Reference in New Issue
Block a user