diff options
Diffstat (limited to 'vendor/github.com/matterbridge/discordgo/wsapi.go')
-rw-r--r-- | vendor/github.com/matterbridge/discordgo/wsapi.go | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/vendor/github.com/matterbridge/discordgo/wsapi.go b/vendor/github.com/matterbridge/discordgo/wsapi.go index 1cf1598e..29a4f613 100644 --- a/vendor/github.com/matterbridge/discordgo/wsapi.go +++ b/vendor/github.com/matterbridge/discordgo/wsapi.go @@ -322,10 +322,10 @@ func (s *Session) heartbeat(wsConn *websocket.Conn, listening <-chan interface{} // UpdateStatusData ia provided to UpdateStatusComplex() type UpdateStatusData struct { - IdleSince *int `json:"since"` - Game *Game `json:"game"` - AFK bool `json:"afk"` - Status string `json:"status"` + IdleSince *int `json:"since"` + Activities []*Activity `json:"activities"` + AFK bool `json:"afk"` + Status string `json:"status"` } type updateStatusOp struct { @@ -333,7 +333,7 @@ type updateStatusOp struct { Data UpdateStatusData `json:"d"` } -func newUpdateStatusData(idle int, gameType GameType, game, url string) *UpdateStatusData { +func newUpdateStatusData(idle int, activityType ActivityType, name, url string) *UpdateStatusData { usd := &UpdateStatusData{ Status: "online", } @@ -342,43 +342,43 @@ func newUpdateStatusData(idle int, gameType GameType, game, url string) *UpdateS usd.IdleSince = &idle } - if game != "" { - usd.Game = &Game{ - Name: game, - Type: gameType, + if name != "" { + usd.Activities = []*Activity{{ + Name: name, + Type: activityType, URL: url, - } + }} } return usd } -// UpdateStatus is used to update the user's status. +// UpdateGameStatus is used to update the user's status. // If idle>0 then set status to idle. -// If game!="" then set game. -// if otherwise, set status to active, and no game. -func (s *Session) UpdateStatus(idle int, game string) (err error) { - return s.UpdateStatusComplex(*newUpdateStatusData(idle, GameTypeGame, game, "")) +// If name!="" then set game. +// if otherwise, set status to active, and no activity. +func (s *Session) UpdateGameStatus(idle int, name string) (err error) { + return s.UpdateStatusComplex(*newUpdateStatusData(idle, ActivityTypeGame, name, "")) } // UpdateStreamingStatus is used to update the user's streaming status. // If idle>0 then set status to idle. -// If game!="" then set game. -// If game!="" and url!="" then set the status type to streaming with the URL set. +// If name!="" then set game. +// If name!="" and url!="" then set the status type to streaming with the URL set. // if otherwise, set status to active, and no game. -func (s *Session) UpdateStreamingStatus(idle int, game string, url string) (err error) { - gameType := GameTypeGame +func (s *Session) UpdateStreamingStatus(idle int, name string, url string) (err error) { + gameType := ActivityTypeGame if url != "" { - gameType = GameTypeStreaming + gameType = ActivityTypeStreaming } - return s.UpdateStatusComplex(*newUpdateStatusData(idle, gameType, game, url)) + return s.UpdateStatusComplex(*newUpdateStatusData(idle, gameType, name, url)) } // UpdateListeningStatus is used to set the user to "Listening to..." -// If game!="" then set to what user is listening to -// Else, set user to active and no game. -func (s *Session) UpdateListeningStatus(game string) (err error) { - return s.UpdateStatusComplex(*newUpdateStatusData(0, GameTypeListening, game, "")) +// If name!="" then set to what user is listening to +// Else, set user to active and no activity. +func (s *Session) UpdateListeningStatus(name string) (err error) { + return s.UpdateStatusComplex(*newUpdateStatusData(0, ActivityTypeListening, name, "")) } // UpdateStatusComplex allows for sending the raw status update data untouched by discordgo. |