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