mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
voice: fix #3418
(kicking bot from voice channel doesn't allow it to rejoin)
This commit is contained in:
@@ -25,7 +25,7 @@ class VoiceStateUpdate extends Action {
|
||||
}
|
||||
|
||||
// Emit event
|
||||
if (member && member.user.id === client.user.id && data.channel_id) {
|
||||
if (member && member.user.id === client.user.id) {
|
||||
client.emit('debug', `[VOICE] received voice state update: ${JSON.stringify(data)}`);
|
||||
client.voice.onVoiceStateUpdate(data);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const Collection = require('../../util/Collection');
|
||||
const { VoiceStatus } = require('../../util/Constants');
|
||||
const VoiceConnection = require('./VoiceConnection');
|
||||
const VoiceBroadcast = require('./VoiceBroadcast');
|
||||
const { Error } = require('../../errors');
|
||||
@@ -52,8 +51,9 @@ class ClientVoiceManager {
|
||||
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) {
|
||||
if (!channel_id) {
|
||||
connection._disconnect();
|
||||
this.connections.delete(guild_id);
|
||||
return;
|
||||
}
|
||||
connection.channel = this.client.channels.get(channel_id);
|
||||
|
||||
@@ -388,6 +388,7 @@ class VoiceConnection extends EventEmitter {
|
||||
ws.removeAllListeners('ready');
|
||||
ws.removeAllListeners('sessionDescription');
|
||||
ws.removeAllListeners('speaking');
|
||||
ws.shutdown();
|
||||
}
|
||||
|
||||
if (udp) udp.removeAllListeners('error');
|
||||
|
||||
Reference in New Issue
Block a user