mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 11:03:30 +01:00
voice: more debug info
This commit is contained in:
@@ -28,12 +28,14 @@ class ClientVoiceManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onVoiceServer({ guild_id, token, endpoint }) {
|
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);
|
const connection = this.connections.get(guild_id);
|
||||||
if (connection) connection.setTokenAndEndpoint(token, endpoint);
|
if (connection) connection.setTokenAndEndpoint(token, endpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
onVoiceStateUpdate({ guild_id, session_id, channel_id }) {
|
onVoiceStateUpdate({ guild_id, session_id, channel_id }) {
|
||||||
const connection = this.connections.get(guild_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 (!connection) return;
|
||||||
if (!channel_id && connection.status !== VoiceStatus.DISCONNECTED) {
|
if (!channel_id && connection.status !== VoiceStatus.DISCONNECTED) {
|
||||||
connection._disconnect();
|
connection._disconnect();
|
||||||
|
|||||||
@@ -195,11 +195,11 @@ class VoiceConnection extends EventEmitter {
|
|||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
setTokenAndEndpoint(token, endpoint) {
|
setTokenAndEndpoint(token, endpoint) {
|
||||||
|
this.emit('debug', `Token "${token}" and endpoint "${endpoint}"`);
|
||||||
if (!endpoint) {
|
if (!endpoint) {
|
||||||
// Signifies awaiting endpoint stage
|
// Signifies awaiting endpoint stage
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.emit('debug', `Token "${token}" and endpoint "${endpoint}"`);
|
|
||||||
|
|
||||||
if (!token) {
|
if (!token) {
|
||||||
this.authenticateFailed('VOICE_TOKEN_ABSENT');
|
this.authenticateFailed('VOICE_TOKEN_ABSENT');
|
||||||
@@ -229,6 +229,7 @@ class VoiceConnection extends EventEmitter {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
setSessionID(sessionID) {
|
setSessionID(sessionID) {
|
||||||
|
this.emit('debug', `Setting sessionID ${sessionID} (stored as "${this.authentication.sessionID}")`);
|
||||||
if (!sessionID) {
|
if (!sessionID) {
|
||||||
this.authenticateFailed('VOICE_SESSION_ABSENT');
|
this.authenticateFailed('VOICE_SESSION_ABSENT');
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user