forked from pothtonswer/discordmuffin
Merge pull request #259 from b1naryth1ef/bugfix/voice-state-update-api-usage
Remove API call in onVoiceStateUpdate
This commit is contained in:
commit
b71136ac14
1 changed files with 2 additions and 12 deletions
14
wsapi.go
14
wsapi.go
|
@ -17,7 +17,6 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"reflect"
|
"reflect"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
@ -523,22 +522,13 @@ func (s *Session) onVoiceStateUpdate(se *Session, st *VoiceStateUpdate) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Need to have this happen at login and store it in the Session
|
|
||||||
// TODO : This should be done upon connecting to Discord, or
|
|
||||||
// be moved to a small helper function
|
|
||||||
self, err := s.User("@me") // TODO: move to Login/New
|
|
||||||
if err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// We only care about events that are about us
|
// We only care about events that are about us
|
||||||
if st.UserID != self.ID {
|
if se.State.Ready.User.ID != st.UserID {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store the SessionID for later use.
|
// Store the SessionID for later use.
|
||||||
voice.UserID = self.ID // TODO: Review
|
voice.UserID = st.UserID // TODO: Review
|
||||||
voice.sessionID = st.SessionID
|
voice.sessionID = st.SessionID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue