Mirror the Voice guard.
This commit is contained in:
parent
b2c76de22e
commit
7d112b562e
1 changed files with 6 additions and 7 deletions
9
wsapi.go
9
wsapi.go
|
@ -321,7 +321,9 @@ func (s *Session) event(messageType int, message []byte) {
|
||||||
}
|
}
|
||||||
var st *VoiceServerUpdate
|
var st *VoiceServerUpdate
|
||||||
if err = unmarshalEvent(e, &st); err == nil {
|
if err = unmarshalEvent(e, &st); err == nil {
|
||||||
|
if s.Voice != nil {
|
||||||
s.onVoiceServerUpdate(st)
|
s.onVoiceServerUpdate(st)
|
||||||
|
}
|
||||||
if s.OnVoiceServerUpdate != nil {
|
if s.OnVoiceServerUpdate != nil {
|
||||||
s.OnVoiceServerUpdate(s, st)
|
s.OnVoiceServerUpdate(s, st)
|
||||||
}
|
}
|
||||||
|
@ -335,7 +337,9 @@ func (s *Session) event(messageType int, message []byte) {
|
||||||
}
|
}
|
||||||
var st *VoiceState
|
var st *VoiceState
|
||||||
if err = unmarshalEvent(e, &st); err == nil {
|
if err = unmarshalEvent(e, &st); err == nil {
|
||||||
|
if s.Voice != nil {
|
||||||
s.onVoiceStateUpdate(st)
|
s.onVoiceStateUpdate(st)
|
||||||
|
}
|
||||||
if s.OnVoiceStateUpdate != nil {
|
if s.OnVoiceStateUpdate != nil {
|
||||||
s.OnVoiceStateUpdate(s, st)
|
s.OnVoiceStateUpdate(s, st)
|
||||||
}
|
}
|
||||||
|
@ -789,11 +793,6 @@ func (s *Session) onVoiceStateUpdate(st *VoiceState) {
|
||||||
// connection and should happen after the VOICE_STATE event.
|
// connection and should happen after the VOICE_STATE event.
|
||||||
func (s *Session) onVoiceServerUpdate(st *VoiceServerUpdate) {
|
func (s *Session) onVoiceServerUpdate(st *VoiceServerUpdate) {
|
||||||
|
|
||||||
// This shouldn't ever be the case, I don't think.
|
|
||||||
if s.Voice == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Store values for later use
|
// Store values for later use
|
||||||
s.Voice.token = st.Token
|
s.Voice.token = st.Token
|
||||||
s.Voice.endpoint = st.Endpoint
|
s.Voice.endpoint = st.Endpoint
|
||||||
|
|
Loading…
Reference in a new issue