voice: properly cleanup after disconnect (#2443, #2435, #2421, #2406 #2359)

This commit is contained in:
Amish Shah
2018-04-07 14:40:05 +01:00
parent 41d0f25d0f
commit 384fdf8f17

View File

@@ -301,6 +301,9 @@ class VoiceConnection extends EventEmitter {
*/
disconnect() {
this.emit('closing');
clearTimeout(this.connectTimeout);
const conn = this.voiceManager.connections.get(this.channel.guild.id);
if (conn === this) this.voiceManager.connections.delete(this.channel.guild.id);
this.sendVoiceStateUpdate({
channel_id: null,
});