Nostrum.Struct.User.Flags (nostrum v0.11.0-dev)

View Source

Struct representing the flags a user account can have

Summary

Types

Bug Hunter (Level 1)

Bug Hunter (Level 2)

Early Supporter

HypeSquad Balance

HypeSquad Bravery

HypeSquad Brilliance

HypeSquad Events

Discord Partner

Raw user flags as sent by the Discord API

Discord Employee

System user

t()

Team User

Verified bot

Verified developer

Functions

Constructs a flag struct based on an integer from the Discord API (either public_flags or flags).

Convert a flag struct to an integer value.

Types

bug_hunter_level_1()

@type bug_hunter_level_1() :: boolean()

Bug Hunter (Level 1)

bug_hunter_level_2()

@type bug_hunter_level_2() :: boolean()

Bug Hunter (Level 2)

early_supporter()

@type early_supporter() :: boolean()

Early Supporter

flags()

@type flags() :: %Nostrum.Struct.User.Flags{
  bug_hunter_level_1: bug_hunter_level_1(),
  bug_hunter_level_2: bug_hunter_level_2(),
  early_supporter: early_supporter(),
  hypesquad_balance: hypesquad_balance(),
  hypesquad_bravery: hypesquad_bravery(),
  hypesquad_brilliance: hypesquad_brilliance(),
  hypesquad_events: hypesquad_events(),
  partner: partner(),
  staff: staff(),
  system: system(),
  team_user: team_user(),
  verified_bot: verified_bot(),
  verified_developer: verified_developer()
}

hypesquad_balance()

@type hypesquad_balance() :: boolean()

HypeSquad Balance

hypesquad_bravery()

@type hypesquad_bravery() :: boolean()

HypeSquad Bravery

hypesquad_brilliance()

@type hypesquad_brilliance() :: boolean()

HypeSquad Brilliance

hypesquad_events()

@type hypesquad_events() :: boolean()

HypeSquad Events

partner()

@type partner() :: boolean()

Discord Partner

raw_flags()

@type raw_flags() :: integer()

Raw user flags as sent by the Discord API

staff()

@type staff() :: boolean()

Discord Employee

system()

@type system() :: boolean()

System user

t()

@type t() :: flags()

team_user()

@type team_user() :: boolean()

Team User

verified_bot()

@type verified_bot() :: boolean()

Verified bot

verified_developer()

@type verified_developer() :: boolean()

Verified developer

Functions

from_integer(flag_value)

@spec from_integer(raw_flags()) :: t()

Constructs a flag struct based on an integer from the Discord API (either public_flags or flags).

Examples

iex> Nostrum.Struct.User.Flags.from_integer(131842)
%Nostrum.Struct.User.Flags{
  bug_hunter_level_1: false,
  bug_hunter_level_2: false,
  early_supporter: true,
  hypesquad_balance: true,
  hypesquad_bravery: false,
  hypesquad_brilliance: false,
  hypesquad_events: false,
  partner: true,
  staff: false,
  system: false,
  team_user: false,
  verified_bot: false,
  verified_developer: true
}

to_integer(flag_struct)

@spec to_integer(t()) :: raw_flags()

Convert a flag struct to an integer value.

Examples

iex> my_flags = %Nostrum.Struct.User.Flags{
...>  bug_hunter_level_1: false,
...>  bug_hunter_level_2: false,
...>  early_supporter: true,
...>  hypesquad_balance: true,
...>  hypesquad_bravery: false,
...>  hypesquad_brilliance: false,
...>  hypesquad_events: false,
...>  partner: true,
...>  staff: false,
...>  system: false,
...>  team_user: false,
...>  verified_bot: false,
...>  verified_developer: true
...> }
iex> Nostrum.Struct.User.Flags.to_integer(my_flags)
131842