forked from pothtonswer/discordmuffin
Merge remote-tracking branch 'bwmarrin/develop' into voice
This commit is contained in:
commit
b2c76de22e
1 changed files with 6 additions and 6 deletions
12
wsapi.go
12
wsapi.go
|
@ -316,6 +316,9 @@ func (s *Session) event(messageType int, message []byte) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
case "VOICE_SERVER_UPDATE":
|
case "VOICE_SERVER_UPDATE":
|
||||||
|
if s.Voice == nil && s.OnVoiceServerUpdate == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
var st *VoiceServerUpdate
|
var st *VoiceServerUpdate
|
||||||
if err = unmarshalEvent(e, &st); err == nil {
|
if err = unmarshalEvent(e, &st); err == nil {
|
||||||
s.onVoiceServerUpdate(st)
|
s.onVoiceServerUpdate(st)
|
||||||
|
@ -327,6 +330,9 @@ func (s *Session) event(messageType int, message []byte) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
case "VOICE_STATE_UPDATE":
|
case "VOICE_STATE_UPDATE":
|
||||||
|
if s.Voice == nil && s.OnVoiceStateUpdate == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
var st *VoiceState
|
var st *VoiceState
|
||||||
if err = unmarshalEvent(e, &st); err == nil {
|
if err = unmarshalEvent(e, &st); err == nil {
|
||||||
s.onVoiceStateUpdate(st)
|
s.onVoiceStateUpdate(st)
|
||||||
|
@ -757,12 +763,6 @@ func (s *Session) ChannelVoiceJoin(gID, cID string, mute, deaf bool) (err error)
|
||||||
// for the session user.
|
// for the session user.
|
||||||
func (s *Session) onVoiceStateUpdate(st *VoiceState) {
|
func (s *Session) onVoiceStateUpdate(st *VoiceState) {
|
||||||
|
|
||||||
// If s.Voice is nil, we must not have even requested to join
|
|
||||||
// a voice channel yet, so this shouldn't be processed.
|
|
||||||
if s.Voice == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Need to have this happen at login and store it in the Session
|
// Need to have this happen at login and store it in the Session
|
||||||
// TODO : This should be done upon connecting to Discord, or
|
// TODO : This should be done upon connecting to Discord, or
|
||||||
// be moved to a small helper function
|
// be moved to a small helper function
|
||||||
|
|
Loading…
Reference in a new issue