From 62537b7debb004eb4bcd26a562f8204d0323439a Mon Sep 17 00:00:00 2001 From: aemino Date: Sat, 1 Jul 2017 02:14:41 -0700 Subject: [PATCH] Ignore setSpeaking requests when VC isn't connected (#1638) --- src/client/voice/VoiceConnection.js | 1 + src/client/voice/dispatcher/StreamDispatcher.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/client/voice/VoiceConnection.js b/src/client/voice/VoiceConnection.js index 562d4211d..903ed9ad0 100644 --- a/src/client/voice/VoiceConnection.js +++ b/src/client/voice/VoiceConnection.js @@ -133,6 +133,7 @@ class VoiceConnection extends EventEmitter { */ setSpeaking(value) { if (this.speaking === value) return; + if (this.status !== Constants.VoiceStatus.CONNECTED) return; this.speaking = value; this.sockets.ws.sendPacket({ op: Constants.VoiceOPCodes.SPEAKING, diff --git a/src/client/voice/dispatcher/StreamDispatcher.js b/src/client/voice/dispatcher/StreamDispatcher.js index 5e3735627..68c83d380 100644 --- a/src/client/voice/dispatcher/StreamDispatcher.js +++ b/src/client/voice/dispatcher/StreamDispatcher.js @@ -1,5 +1,6 @@ const VolumeInterface = require('../util/VolumeInterface'); const VoiceBroadcast = require('../VoiceBroadcast'); +const Constants = require('../../../util/Constants'); const secretbox = require('../util/Secretbox'); @@ -108,6 +109,7 @@ class StreamDispatcher extends VolumeInterface { setSpeaking(value) { if (this.speaking === value) return; + if (this.player.voiceConnection.status !== Constants.VoiceStatus.CONNECTED) return; this.speaking = value; /** * Emitted when the dispatcher starts/stops speaking.