Skip to content
This repository was archived by the owner on Mar 5, 2023. It is now read-only.

Commit 2daab50

Browse files
Add Presence ClientStatus (bwmarrin#1303)
* Add ClientStatus struct * Add ClientStatus struct * Add comment * Update structs.go Co-authored-by: Fedor Lapshin <[email protected]> Co-authored-by: Fedor Lapshin <[email protected]>
1 parent f184824 commit 2daab50

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

state.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,15 @@ func (s *State) presenceAdd(guildID string, presence *Presence) error {
207207
if presence.Status != "" {
208208
guild.Presences[i].Status = presence.Status
209209
}
210+
if presence.ClientStatus.Desktop != "" {
211+
guild.Presences[i].ClientStatus.Desktop = presence.ClientStatus.Desktop
212+
}
213+
if presence.ClientStatus.Mobile != "" {
214+
guild.Presences[i].ClientStatus.Mobile = presence.ClientStatus.Mobile
215+
}
216+
if presence.ClientStatus.Web != "" {
217+
guild.Presences[i].ClientStatus.Web = presence.ClientStatus.Web
218+
}
210219

211220
//Update the optionally sent user information
212221
//ID Is a mandatory field so you should not need to check if it is empty

structs.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,10 +1267,11 @@ type VoiceState struct {
12671267

12681268
// A Presence stores the online, offline, or idle and game status of Guild members.
12691269
type Presence struct {
1270-
User *User `json:"user"`
1271-
Status Status `json:"status"`
1272-
Activities []*Activity `json:"activities"`
1273-
Since *int `json:"since"`
1270+
User *User `json:"user"`
1271+
Status Status `json:"status"`
1272+
Activities []*Activity `json:"activities"`
1273+
Since *int `json:"since"`
1274+
ClientStatus ClientStatus `json:"client_status"`
12741275
}
12751276

12761277
// 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 {
13621363

13631364
}
13641365

1366+
// ClientStatus stores the online, offline, idle, or dnd status of each device of a Guild member.
1367+
type ClientStatus struct {
1368+
Desktop Status `json:"desktop"`
1369+
Mobile Status `json:"mobile"`
1370+
Web Status `json:"web"`
1371+
}
1372+
13651373
// Status type definition
13661374
type Status string
13671375

0 commit comments

Comments
 (0)