From e8b8ad326b1d1a0b829bac7992bffdb0bf177215 Mon Sep 17 00:00:00 2001 From: LightningDev1 <59872288+LightningDev1@users.noreply.github.com> Date: Mon, 4 Dec 2023 11:34:26 +0100 Subject: [PATCH] feat(user): add UserPremiumType type (#1467) * feat(user): Add UserPremiumType type * chore(UserPremiumType): fix type name in comment * style: periods Add periods at the end of the documentation comments. * chore(UserPremiumType): reword documentation comment --------- Co-authored-by: Fedor Lapshin --- user.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/user.go b/user.go index 5a91adf..12e24b5 100644 --- a/user.go +++ b/user.go @@ -26,6 +26,18 @@ const ( UserFlagDiscordCertifiedModerator UserFlags = 1 << 18 ) +// UserPremiumType is the type of premium (nitro) subscription a user has (see UserPremiumType* consts). +// https://discord.com/developers/docs/resources/user#user-object-premium-types +type UserPremiumType int + +// Valid UserPremiumType values. +const ( + UserPremiumTypeNone UserPremiumType = 0 + UserPremiumTypeNitroClassic UserPremiumType = 1 + UserPremiumTypeNitro UserPremiumType = 2 + UserPremiumTypeNitroBasic UserPremiumType = 3 +) + // A User stores all data for an individual Discord user. type User struct { // The ID of the user. @@ -78,7 +90,7 @@ type User struct { // The type of Nitro subscription on a user's account. // Only available when the request is authorized via a Bearer token. - PremiumType int `json:"premium_type"` + PremiumType UserPremiumType `json:"premium_type"` // Whether the user is an Official Discord System user (part of the urgent message system). System bool `json:"system"`