crux_structs v0.2.3 Crux.Structs.Message.Flags View Source

Custom non discord API struct helping with the usage of message flags.

Currently it's only possible to edit the suppress_embeds flag.

Link to this section Summary

Types

Union type of all valid message flags.

Raw bitfield that can be used as a t:resolvable/0.

All valid types that can be directly resolved into a bitfield.

t()

Functions

Add all set bits of to_add to base.

Get an integer representing all available bits set.

Get a map of t:name/0s and their corresponding bit values.

Check whether the t:resolvable/0 you have has everything set you want.

Return a t:t/0 of all bits you want but not have.

Get a list of all available t:name/0s.

Remove all set bits of to_remove from base.

Resolve a t:resolvable/0 into a bitfield.

Serialize a t:resolvable/0 into a list of set bit flag names.

Serialize a t:resolvable/0 into a map representing bit flag names to whether they are set.

Link to this section Types

Specs

name() ::
  :crossposted
  | :is_crosspost
  | :suppress_embeds
  | :source_message_deleted
  | :urgent

Union type of all valid message flags.

Specs

raw() :: non_neg_integer()

Raw bitfield that can be used as a t:resolvable/0.

Specs

resolvable() :: t() | raw() | name() | [resolvable()]

All valid types that can be directly resolved into a bitfield.

Specs

t() :: %Crux.Structs.Message.Flags{bitfield: non_neg_integer()}

Link to this section Functions

Specs

add(base :: resolvable(), to_add :: resolvable()) :: t()

Add all set bits of to_add to base.

Specs

all() :: non_neg_integer()

Get an integer representing all available bits set.

Specs

flags() :: %{required(name()) => non_neg_integer()}

Get a map of t:name/0s and their corresponding bit values.

Specs

has(have :: resolvable(), want :: resolvable()) :: boolean()

Check whether the t:resolvable/0 you have has everything set you want.

Specs

missing(resolvable(), resolvable()) :: t()

Return a t:t/0 of all bits you want but not have.

Specs

names() :: [name()]

Get a list of all available t:name/0s.

Specs

new(resolvable()) :: t()

Create a new t:t/0 from a t:resolvable/0.

Specs

remove(base :: resolvable(), to_remove :: resolvable()) :: t()

Remove all set bits of to_remove from base.

Specs

resolve(resolvable()) :: non_neg_integer()

Resolve a t:resolvable/0 into a bitfield.

Specs

to_list(resolvable()) :: [name()]

Serialize a t:resolvable/0 into a list of set bit flag names.

Specs

to_map(resolvable()) :: %{required(name()) => boolean()}

Serialize a t:resolvable/0 into a map representing bit flag names to whether they are set.