Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(member): add flags #1499

Merged
merged 4 commits into from
Feb 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 20 additions & 0 deletions structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1469,6 +1469,22 @@ type Assets struct {
SmallText string `json:"small_text,omitempty"`
}

// MemberFlags represent flags of a guild member.
// https://discord.com/developers/docs/resources/guild#guild-member-object-guild-member-flags
type MemberFlags int

// Block containing known MemberFlags values.
const (
// MemberFlagDidRejoin indicates whether the Member has left and rejoined the guild.
MemberFlagDidRejoin MemberFlags = 1 << 0
// MemberFlagCompletedOnboarding indicates whether the Member has completed onboarding.
MemberFlagCompletedOnboarding MemberFlags = 1 << 1
// MemberFlagBypassesVerification indicates whether the Member is exempt from guild verification requirements.
MemberFlagBypassesVerification MemberFlags = 1 << 2
// MemberFlagStartedOnboarding indicates whether the Member has started onboarding.
MemberFlagStartedOnboarding MemberFlags = 1 << 3
)

// A Member stores user information for Guild members. A guild
// member represents a certain user's presence in a guild.
type Member struct {
Expand Down Expand Up @@ -1499,6 +1515,10 @@ type Member struct {
// When the user used their Nitro boost on the server
PremiumSince *time.Time `json:"premium_since"`

// The flags of this member. 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.
Flags MemberFlags `json:"flags"`

// Is true while the member hasn't accepted the membership screen.
Pending bool `json:"pending"`

Expand Down