From 994ddca1e13b4ae048060f82e58cc6e24e3db2f2 Mon Sep 17 00:00:00 2001 From: diamondburned Date: Wed, 28 Oct 2020 14:39:44 -0700 Subject: [PATCH] Discord: Updated the Presence struct to be smaller This commit omits a few fields in the Presence struct in accordance to the new v8 structures. Removed roles, premium_since, and nick --- discord/guild.go | 40 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/discord/guild.go b/discord/guild.go index 02da07c..a05b871 100644 --- a/discord/guild.go +++ b/discord/guild.go @@ -300,41 +300,33 @@ func (r Role) Mention() string { return r.ID.Mention() } +// ClientStaus is the user's platform-dependent status. +// +// https://discord.com/developers/docs/topics/gateway#client-status-object +type ClientStatus struct { + // Desktop is the user's status set for an active desktop (Windows, + // Linux, Mac) application session. + Desktop Status `json:"desktop,omitempty"` + // Mobile is the user's status set for an active mobile (iOS, Android) + // application session. + Mobile Status `json:"mobile,omitempty"` + // Web is the user's status set for an active web (browser, bot + // account) application session. + Web Status `json:"web,omitempty"` +} + // https://discord.com/developers/docs/topics/gateway#presence-update type Presence struct { // User is the user presence is being updated for. User User `json:"user"` - // RoleIDs are the roles this user is in. - RoleIDs []RoleID `json:"roles"` - - // These fields are only filled in gateway events, according to the - // documentation. - // GuildID is the id of the guild GuildID GuildID `json:"guild_id"` - // Status is either "idle", "dnd", "online", or "offline". Status Status `json:"status"` // Activities are the user's current activities. Activities []Activity `json:"activities"` // ClientStaus is the user's platform-dependent status. - // - // https://discord.com/developers/docs/topics/gateway#client-status-object - ClientStatus struct { - // Desktop is the user's status set for an active desktop (Windows, - // Linux, Mac) application session. - Desktop Status `json:"desktop,omitempty"` - // Mobile is the user's status set for an active mobile (iOS, Android) - // application session. - Mobile Status `json:"mobile,omitempty"` - // Web is the user's status set for an active web (browser, bot - // account) application session. - Web Status `json:"web,omitempty"` - } `json:"client_status"` - // Premium since specifies when the user started boosting the guild. - PremiumSince Timestamp `json:"premium_since,omitempty"` - // Nick is this users guild nickname (if one is set). - Nick string `json:"nick,omitempty"` + ClientStatus ClientStatus `json:"client_status"` } // https://discord.com/developers/docs/resources/guild#guild-member-object