mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 10:03:31 +01:00
Added voice disconnect
This commit is contained in:
@@ -42,7 +42,6 @@ class VoiceConnection extends EventEmitter {
|
||||
|
||||
this.player.on('error', e => {
|
||||
this.emit('warn', e);
|
||||
console.log('so yeah uh' + e);
|
||||
this.player.cleanup();
|
||||
});
|
||||
|
||||
@@ -63,9 +62,26 @@ class VoiceConnection extends EventEmitter {
|
||||
speaking: true,
|
||||
delay: 0,
|
||||
},
|
||||
})
|
||||
.catch(e => {
|
||||
this.emit('debug', e);
|
||||
});
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
this.emit('closing');
|
||||
this.voiceManager.client.ws.send({
|
||||
op: Constants.OPCodes.VOICE_STATE_UPDATE,
|
||||
d: {
|
||||
guild_id: this.channel.guild.id,
|
||||
channel_id: null,
|
||||
self_mute: false,
|
||||
self_deaf: false,
|
||||
},
|
||||
});
|
||||
this.emit('disconnected');
|
||||
}
|
||||
|
||||
connect() {
|
||||
if (this.sockets.ws) {
|
||||
throw new Error('There is already an existing WebSocket connection!');
|
||||
|
||||
Reference in New Issue
Block a user