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(role): add flags #1410

Merged
merged 9 commits into from
Mar 7, 2024
Merged
Changes from 5 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
15 changes: 15 additions & 0 deletions structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1355,8 +1355,23 @@ type Role struct {

// The emoji assigned to this role.
UnicodeEmoji string `json:"unicode_emoji"`

// The flags of the role, which describe extra features of a role.
// This is a combination of bit masks; the presence of a certain permission can
// be checked by performing a bitwise AND between this int and the flag.
Flags RoleFlags `json:"flags"`
}

// RoleFlags is the flags of "role" (see RoleFlags* consts)
Earlopain marked this conversation as resolved.
Show resolved Hide resolved
// https://discord.com/developers/docs/topics/permissions#role-object-role-flags
type RoleFlags int

// Block containing known RoleFlags values.
const (
// RoleFlagInPrompt indicates a Role to be selectable by members in an onboarding prompt.
Earlopain marked this conversation as resolved.
Show resolved Hide resolved
RoleFlagInPrompt RoleFlags = 1 << 0
)

// Mention returns a string which mentions the role
func (r *Role) Mention() string {
return fmt.Sprintf("<@&%s>", r.ID)
Expand Down