mirror of
https://github.com/danbulant/discord.js
synced 2026-07-05 03:00:35 +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
|
// 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.emit('debug', `[VOICE] received voice state update: ${JSON.stringify(data)}`);
|
||||||
client.voice.onVoiceStateUpdate(data);
|
client.voice.onVoiceStateUpdate(data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const Collection = require('../../util/Collection');
|
const Collection = require('../../util/Collection');
|
||||||
const { VoiceStatus } = require('../../util/Constants');
|
|
||||||
const VoiceConnection = require('./VoiceConnection');
|
const VoiceConnection = require('./VoiceConnection');
|
||||||
const VoiceBroadcast = require('./VoiceBroadcast');
|
const VoiceBroadcast = require('./VoiceBroadcast');
|
||||||
const { Error } = require('../../errors');
|
const { Error } = require('../../errors');
|
||||||
|
|
@ -52,8 +51,9 @@ class ClientVoiceManager {
|
||||||
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}`);
|
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._disconnect();
|
connection._disconnect();
|
||||||
|
this.connections.delete(guild_id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
connection.channel = this.client.channels.get(channel_id);
|
connection.channel = this.client.channels.get(channel_id);
|
||||||
|
|
|
||||||
|
|
@ -388,6 +388,7 @@ class VoiceConnection extends EventEmitter {
|
||||||
ws.removeAllListeners('ready');
|
ws.removeAllListeners('ready');
|
||||||
ws.removeAllListeners('sessionDescription');
|
ws.removeAllListeners('sessionDescription');
|
||||||
ws.removeAllListeners('speaking');
|
ws.removeAllListeners('speaking');
|
||||||
|
ws.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (udp) udp.removeAllListeners('error');
|
if (udp) udp.removeAllListeners('error');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue