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
This commit is contained in:
zekro 2020-08-08 23:42:45 +02:00 committed by GitHub
parent 7b0771c3d7
commit b806975e3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

26
user.go
View file

@ -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