mirror of
https://github.com/danbulant/discord.js
synced 2026-06-18 22:21:17 +00:00
voice: fix #3418
(kicking bot from voice channel doesn't allow it to rejoin)
This commit is contained in:
parent
2c4d14a71b
commit
c6e8fccbf0
3 changed files with 4 additions and 3 deletions
|
|
@ -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');
|
||||
|
|
|
|||
Loading…
Reference in a new issue