From b806975e3be96be86c935e76f9c1709122acec3d Mon Sep 17 00:00:00 2001 From: zekro Date: Sat, 8 Aug 2020 23:42:45 +0200 Subject: [PATCH] add user public flags field and public flag consts (#801) * add user public flags field and public flag consts * fix user flag constant initialization and vaalue documentation * fix user flag constants values --- user.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/user.go b/user.go index a9af31a..316789b 100644 --- a/user.go +++ b/user.go @@ -2,6 +2,27 @@ package discordgo import "strings" +// UserFlags is the flags of "user" (see UserFlags* consts) +// https://discord.com/developers/docs/resources/user#user-object-user-flags +type UserFlags int + +// Valid UserFlags values +const ( + UserFlagDiscordEmployee UserFlags = 1 << 0 + UserFlagDiscordPartner = 1 << 1 + UserFlagHypeSquadEvents = 1 << 2 + UserFlagBugHunterLevel1 = 1 << 3 + UserFlagHouseBravery = 1 << 6 + UserFlagHouseBrilliance = 1 << 7 + UserFlagHouseBalance = 1 << 8 + UserFlagEarlySupporter = 1 << 9 + UserFlagTeamUser = 1 << 10 + UserFlagSystem = 1 << 12 + UserFlagBugHunterLevel2 = 1 << 14 + UserFlagVerifiedBot = 1 << 16 + UserFlagVerifiedBotDeveloper = 1 << 17 +) + // A User stores all data for an individual Discord user. type User struct { // The ID of the user. @@ -36,6 +57,11 @@ type User struct { // Whether the user is a bot. Bot bool `json:"bot"` + + // The public flags on a user's account. + // This is a combination of bit masks; the presence of a certain flag can + // be checked by performing a bitwise AND between this int and the flag. + PublicFlags UserFlags `json:"public_flags"` } // String returns a unique identifier of the form username#discriminator