diff --git a/voice.go b/voice.go index 586b783..dbafd83 100644 --- a/voice.go +++ b/voice.go @@ -139,6 +139,7 @@ func (v *VoiceConnection) ChangeChannel(channelID string, mute, deaf bool) (err func (v *VoiceConnection) Disconnect() (err error) { // Send a OP4 with a nil channel to disconnect + v.Lock() if v.sessionID != "" { data := voiceChannelJoinOp{4, voiceChannelJoinData{&v.GuildID, nil, true, true}} v.session.wsMutex.Lock() @@ -146,6 +147,7 @@ func (v *VoiceConnection) Disconnect() (err error) { v.session.wsMutex.Unlock() v.sessionID = "" } + v.Unlock() // Close websocket and udp connections v.Close()