Fix presence update after breaking API change (#427)

This commit is contained in:
Jonas is my name 2017-08-17 15:55:02 +02:00 committed by Chris Rhodes
parent 3f2c1311d5
commit 308d058bf1
2 changed files with 9 additions and 4 deletions

View file

@ -316,7 +316,7 @@ type Presence struct {
type Game struct { type Game struct {
Name string `json:"name"` Name string `json:"name"`
Type int `json:"type"` Type int `json:"type"`
URL string `json:"url"` URL string `json:"url,omitempty"`
} }
// UnmarshalJSON unmarshals json to Game struct // UnmarshalJSON unmarshals json to Game struct

View file

@ -250,8 +250,10 @@ func (s *Session) heartbeat(wsConn *websocket.Conn, listening <-chan interface{}
} }
type updateStatusData struct { type updateStatusData struct {
IdleSince *int `json:"idle_since"` IdleSince *int `json:"since"`
Game *Game `json:"game"` Game *Game `json:"game"`
AFK bool `json:"afk"`
Status string `json:"status"`
} }
type updateStatusOp struct { type updateStatusOp struct {
@ -274,7 +276,10 @@ func (s *Session) UpdateStreamingStatus(idle int, game string, url string) (err
return ErrWSNotFound return ErrWSNotFound
} }
var usd updateStatusData usd := updateStatusData{
Status: "online",
}
if idle > 0 { if idle > 0 {
usd.IdleSince = &idle usd.IdleSince = &idle
} }