Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Presence ClientStatus #1303

Merged
merged 4 commits into from
Dec 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions state.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 12 additions & 4 deletions structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1235,10 +1235,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
Expand Down Expand Up @@ -1330,6 +1331,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

Expand Down