Add Presence ClientStatus (#1303)

* Add ClientStatus struct

* Add ClientStatus struct

* Add comment

* Update structs.go

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>
This commit is contained in:
ikafly144 2022-12-30 02:52:07 +09:00 committed by GitHub
parent f184824b8c
commit 2daab506b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 4 deletions

View file

@ -207,6 +207,15 @@ func (s *State) presenceAdd(guildID string, presence *Presence) error {
if presence.Status != "" {
guild.Presences[i].Status = presence.Status
}
if presence.ClientStatus.Desktop != "" {
guild.Presences[i].ClientStatus.Desktop = presence.ClientStatus.Desktop
}
if presence.ClientStatus.Mobile != "" {
guild.Presences[i].ClientStatus.Mobile = presence.ClientStatus.Mobile
}
if presence.ClientStatus.Web != "" {
guild.Presences[i].ClientStatus.Web = presence.ClientStatus.Web
}
//Update the optionally sent user information
//ID Is a mandatory field so you should not need to check if it is empty

View file

@ -1267,10 +1267,11 @@ type VoiceState struct {
// A Presence stores the online, offline, or idle and game status of Guild members.
type Presence struct {
User *User `json:"user"`
Status Status `json:"status"`
Activities []*Activity `json:"activities"`
Since *int `json:"since"`
User *User `json:"user"`
Status Status `json:"status"`
Activities []*Activity `json:"activities"`
Since *int `json:"since"`
ClientStatus ClientStatus `json:"client_status"`
}
// A TimeStamps struct contains start and end times used in the rich presence "playing .." Game
@ -1362,6 +1363,13 @@ func (m *Member) AvatarURL(size string) string {
}
// ClientStatus stores the online, offline, idle, or dnd status of each device of a Guild member.
type ClientStatus struct {
Desktop Status `json:"desktop"`
Mobile Status `json:"mobile"`
Web Status `json:"web"`
}
// Status type definition
type Status string