forked from pothtonswer/discordmuffin
Remove code duplication in ChannelVoiceJoin (#611)
This commit is contained in:
parent
e184c57068
commit
aca3f3898c
1 changed files with 1 additions and 9 deletions
10
wsapi.go
10
wsapi.go
|
@ -615,11 +615,7 @@ func (s *Session) ChannelVoiceJoin(gID, cID string, mute, deaf bool) (voice *Voi
|
||||||
voice.session = s
|
voice.session = s
|
||||||
voice.Unlock()
|
voice.Unlock()
|
||||||
|
|
||||||
// Send the request to Discord that we want to join the voice channel
|
err = s.ChannelVoiceJoinManual(gID, cID, mute, deaf)
|
||||||
data := voiceChannelJoinOp{4, voiceChannelJoinData{&gID, &cID, mute, deaf}}
|
|
||||||
s.wsMutex.Lock()
|
|
||||||
err = s.wsConn.WriteJSON(data)
|
|
||||||
s.wsMutex.Unlock()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -652,10 +648,6 @@ func (s *Session) ChannelVoiceJoinManual(gID, cID string, mute, deaf bool) (err
|
||||||
s.wsMutex.Lock()
|
s.wsMutex.Lock()
|
||||||
err = s.wsConn.WriteJSON(data)
|
err = s.wsConn.WriteJSON(data)
|
||||||
s.wsMutex.Unlock()
|
s.wsMutex.Unlock()
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue