mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
Fixed leaving voice channels
This commit is contained in:
@@ -48,10 +48,20 @@ var VoiceConnection = (function (_EventEmitter) {
|
||||
}
|
||||
|
||||
VoiceConnection.prototype.destroy = function destroy() {
|
||||
console.log("you wanted to destroy _me_?!");
|
||||
this.stopPlaying();
|
||||
if (this.KAI) clearInterval(this.KAI);
|
||||
this.vWS.close();
|
||||
this.udp.close();
|
||||
this.client.internal.sendWS({
|
||||
op: 4,
|
||||
d: {
|
||||
guild_id: null,
|
||||
channel_id: null,
|
||||
self_mute: true,
|
||||
self_deaf: false
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
VoiceConnection.prototype.stopPlaying = function stopPlaying() {
|
||||
|
||||
@@ -40,11 +40,23 @@ class VoiceConnection extends EventEmitter {
|
||||
}
|
||||
|
||||
destroy() {
|
||||
console.log("you wanted to destroy _me_?!");
|
||||
this.stopPlaying();
|
||||
if(this.KAI)
|
||||
clearInterval(this.KAI);
|
||||
this.vWS.close();
|
||||
this.udp.close();
|
||||
this.client.internal.sendWS(
|
||||
{
|
||||
op : 4,
|
||||
d : {
|
||||
guild_id : null,
|
||||
channel_id : null,
|
||||
self_mute : true,
|
||||
self_deaf : false
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
stopPlaying() {
|
||||
|
||||
@@ -20,6 +20,9 @@ client.on("message", m => {
|
||||
client.internal.voiceConnection.stopPlaying();
|
||||
}
|
||||
return;
|
||||
}if (m.content.startsWith("$$$ leave")) {
|
||||
client.internal.leaveVoiceChannel();
|
||||
return;
|
||||
}
|
||||
if (m.content.startsWith("$$$")) {
|
||||
var chan;
|
||||
|
||||
Reference in New Issue
Block a user