Added voice disconnect

This commit is contained in:
Amish Shah
2016-10-25 14:18:20 +01:00
parent b0921ae0ef
commit 91ba59c43d
8 changed files with 56 additions and 11 deletions

View File

@@ -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!');