Remedy.Schema.Permission (Remedy v0.6.8) View Source
Permissions Object
Link to this section Summary
Functions
Returns a list of all permissions.
Converts the given bit to a permission.
Same as from_bit/1, but raises ArgumentError in case of failure.
Converts the given bitset to a list of permissions.
Returns true if term is a permission; otherwise returns false.
Converts the given permission to a bit.
Converts the given enumerable of permissions to a bitset.
Link to this section Types
Specs
bit() :: non_neg_integer()
Represents a single permission as a bitvalue.
Specs
bitset() :: non_neg_integer()
Represents a set of permissions as a bitvalue.
Specs
t() :: %Remedy.Schema.Permission{
ADD_REACTIONS: boolean(),
ADMINISTRATOR: boolean(),
ATTACH_FILES: boolean(),
BAN_MEMBERS: boolean(),
CHANGE_NICKNAME: boolean(),
CONNECT: boolean(),
CREATE_INSTANT_INVITE: boolean(),
DEAFEN_MEMBERS: boolean(),
EMBED_LINKS: boolean(),
KICK_MEMBERS: boolean(),
MANAGE_CHANNELS: boolean(),
MANAGE_EMOJIS_AND_STICKERS: boolean(),
MANAGE_GUILD: boolean(),
MANAGE_MESSAGES: boolean(),
MANAGE_NICKNAMES: boolean(),
MANAGE_ROLES: boolean(),
MANAGE_THREADS: boolean(),
MANAGE_WEBHOOKS: boolean(),
MENTION_EVERYONE: boolean(),
MOVE_MEMBERS: boolean(),
MUTE_MEMBERS: boolean(),
PRIORITY_SPEAKER: boolean(),
READ_MESSAGE_HISTORY: boolean(),
REQUEST_TO_SPEAK: boolean(),
SEND_MESSAGES: boolean(),
SEND_TTS_MESSAGES: boolean(),
SPEAK: boolean(),
STREAM: boolean(),
USE_APPLICATION_COMMANDS: boolean(),
USE_EXTERNAL_EMOJIS: boolean(),
USE_EXTERNAL_STICKERS: boolean(),
USE_PRIVATE_THREADS: boolean(),
USE_PUBLIC_THREADS: boolean(),
USE_VAD: boolean(),
VIEW_AUDIT_LOG: boolean(),
VIEW_CHANNEL: boolean(),
VIEW_GUILD_INSIGHTS: boolean(),
id: term()
}
Link to this section Functions
Returns a list of all permissions.
Specs
Converts the given bit to a permission.
This function returns :error if bit does not map to a permission.
Examples
iex> Remedy.Permission.from_bit(0x04000000)
{:ok, :change_nickname}
iex> Remedy.Permission.from_bit(0)
:error
Specs
Same as from_bit/1, but raises ArgumentError in case of failure.
Examples
iex> Remedy.Permission.from_bit!(0x04000000)
:change_nickname
iex> Remedy.Permission.from_bit!(0)
** (ArgumentError) expected a valid bit, got: `0`
Specs
Converts the given bitset to a list of permissions.
If invalid bits are given they will be omitted from the results.
Examples
iex> Remedy.Permission.from_bitset(0x08000002)
[:manage_nicknames, :kick_members]
iex> Remedy.Permission.from_bitset(0x4000000000000)
[]
Returns true if term is a permission; otherwise returns false.
Examples
iex> Remedy.Permission.is_permission(:administrator)
true
iex> Remedy.Permission.is_permission(:not_a_permission)
false
Converts the given permission to a bit.
Examples
iex> Remedy.Permission.to_bit(:administrator)
8
Specs
Converts the given enumerable of permissions to a bitset.
Examples
iex> Remedy.Permission.to_bitset([:administrator, :create_instant_invite])
9