fix: stream dispatcher throwing key error due to missing secretKey

This commit is contained in:
Amish Shah
2018-01-13 12:47:19 +00:00
parent d96f5f246d
commit 8cab673fea
2 changed files with 3 additions and 2 deletions

View File

@@ -155,7 +155,8 @@ class VoiceWebSocket extends EventEmitter {
onPacket(packet) {
switch (packet.op) {
case VoiceOPCodes.READY:
this.setHeartbeat(packet.d.heartbeat_interval);
// *.75 to correct for discord devs taking longer to fix things than i do to release versions
this.setHeartbeat(packet.d.heartbeat_interval * 0.75);
/**
* Emitted once the voice WebSocket receives the ready packet.
* @param {Object} packet The received packet

View File

@@ -207,7 +207,7 @@ class StreamDispatcher extends Writable {
}
_playChunk(chunk) {
if (this.player.dispatcher !== this) return;
if (this.player.dispatcher !== this || !this.player.voiceConnection.authentication.secretKey) return;
this._setSpeaking(true);
this._sendPacket(this._createPacket(this._sdata.sequence, this._sdata.timestamp, chunk));
}