mirror of
https://github.com/danbulant/discord.js
synced 2026-05-27 22:11:53 +00:00
voice: fix receiver null on immediate voiceStateUpdate
This commit is contained in:
parent
3418b5a1a2
commit
2d68e837e5
3 changed files with 3 additions and 3 deletions
|
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue