From 810b5a5f7175cb916ed3b9fea23ebf623eed8147 Mon Sep 17 00:00:00 2001 From: Amish Shah Date: Mon, 11 Feb 2019 17:57:56 +0000 Subject: [PATCH] voice: more debug info --- src/client/voice/ClientVoiceManager.js | 2 ++ src/client/voice/VoiceConnection.js | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/client/voice/ClientVoiceManager.js b/src/client/voice/ClientVoiceManager.js index 52b14ed19..e65effdd7 100644 --- a/src/client/voice/ClientVoiceManager.js +++ b/src/client/voice/ClientVoiceManager.js @@ -28,12 +28,14 @@ class ClientVoiceManager { } onVoiceServer({ guild_id, token, endpoint }) { + this.client.emit('debug', `[VOICE] voiceServer guild: ${guild_id} token: ${token} endpoint: ${endpoint}`); const connection = this.connections.get(guild_id); if (connection) connection.setTokenAndEndpoint(token, endpoint); } onVoiceStateUpdate({ guild_id, session_id, channel_id }) { const connection = this.connections.get(guild_id); + this.client.emit('debug', `[VOICE] connection? ${!!connection}, ${guild_id} ${session_id} ${channel_id}`); if (!connection) return; if (!channel_id && connection.status !== VoiceStatus.DISCONNECTED) { connection._disconnect(); diff --git a/src/client/voice/VoiceConnection.js b/src/client/voice/VoiceConnection.js index 6e07c92d2..6a945731c 100644 --- a/src/client/voice/VoiceConnection.js +++ b/src/client/voice/VoiceConnection.js @@ -195,11 +195,11 @@ class VoiceConnection extends EventEmitter { * @returns {void} */ setTokenAndEndpoint(token, endpoint) { + this.emit('debug', `Token "${token}" and endpoint "${endpoint}"`); if (!endpoint) { // Signifies awaiting endpoint stage return; } - this.emit('debug', `Token "${token}" and endpoint "${endpoint}"`); if (!token) { this.authenticateFailed('VOICE_TOKEN_ABSENT'); @@ -229,6 +229,7 @@ class VoiceConnection extends EventEmitter { * @private */ setSessionID(sessionID) { + this.emit('debug', `Setting sessionID ${sessionID} (stored as "${this.authentication.sessionID}")`); if (!sessionID) { this.authenticateFailed('VOICE_SESSION_ABSENT'); return;