mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 18:43:31 +01:00
voice: more debug information
This commit is contained in:
@@ -26,6 +26,7 @@ class VoiceStateUpdate extends Action {
|
|||||||
|
|
||||||
// Emit event
|
// Emit event
|
||||||
if (member && member.user.id === client.user.id && data.channel_id) {
|
if (member && member.user.id === client.user.id && data.channel_id) {
|
||||||
|
client.emit('debug', `[VOICE] received voice state update: ${JSON.stringify(data)}`);
|
||||||
client.emit('self.voiceStateUpdate', data);
|
client.emit('self.voiceStateUpdate', data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,6 +64,8 @@ class ClientVoiceManager {
|
|||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
connection = new VoiceConnection(this, channel);
|
connection = new VoiceConnection(this, channel);
|
||||||
|
connection.on('debug', msg => this.client.emit('debug', `[VOICE (${channel.guild.id})]: ${msg}`));
|
||||||
|
connection.authenticate();
|
||||||
this.connections.set(channel.guild.id, connection);
|
this.connections.set(channel.guild.id, connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,8 +74,6 @@ class ClientVoiceManager {
|
|||||||
reject(reason);
|
reject(reason);
|
||||||
});
|
});
|
||||||
|
|
||||||
connection.on('debug', msg => this.client.emit('debug', `[VOICE (${channel.guild.id})]: ${msg}`));
|
|
||||||
|
|
||||||
connection.once('authenticated', () => {
|
connection.once('authenticated', () => {
|
||||||
connection.once('ready', () => {
|
connection.once('ready', () => {
|
||||||
resolve(connection);
|
resolve(connection);
|
||||||
|
|||||||
@@ -125,8 +125,6 @@ class VoiceConnection extends EventEmitter {
|
|||||||
* @type {VoiceReceiver}
|
* @type {VoiceReceiver}
|
||||||
*/
|
*/
|
||||||
this.receiver = new VoiceReceiver(this);
|
this.receiver = new VoiceReceiver(this);
|
||||||
|
|
||||||
this.authenticate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -180,6 +178,9 @@ class VoiceConnection extends EventEmitter {
|
|||||||
self_deaf: false,
|
self_deaf: false,
|
||||||
}, options);
|
}, options);
|
||||||
|
|
||||||
|
const queueLength = this.channel.guild.shard.ratelimit.queue.length;
|
||||||
|
this.emit('debug', `Sending voice state update (queue length is ${queueLength}): ${JSON.stringify(options)}`);
|
||||||
|
|
||||||
this.channel.guild.shard.send({
|
this.channel.guild.shard.send({
|
||||||
op: OPCodes.VOICE_STATE_UPDATE,
|
op: OPCodes.VOICE_STATE_UPDATE,
|
||||||
d: options,
|
d: options,
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
module.exports = (client, packet) => {
|
module.exports = (client, packet) => {
|
||||||
|
client.emit('debug', `[VOICE] received voice server: ${JSON.stringify(packet)}`);
|
||||||
client.emit('self.voiceServer', packet.d);
|
client.emit('self.voiceServer', packet.d);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user