Nostrum v0.4.1 Nostrum.Struct.Guild.Role View Source

Struct representing a Discord role.

Mentioning Roles in Messages

A Nostrum.Struct.Guild.Role can be mentioned in message content using the String.Chars protocol or mention/1.

role = %Nostrum.Struct.Guild.Role{id: 431886897539973131}
Nostrum.Api.create_message!(184046599834435585, "#{role}")
%Nostrum.Struct.Message{}

role = %Nostrum.Struct.Guild.Role{id: 431884023535632398}
Nostrum.Api.create_message!(280085880452939778, "#{Nostrum.Struct.Guild.Role.mention(role)}")
%Nostrum.Struct.Message{}

Link to this section Summary

Types

The hexadecimal color code

Whether the role is pinned in the user listing

The id of the role

Whether the role is managed by an integration

Whether the role is mentionable

The name of the role

The permission bit set

The position of the role

t()

Functions

Formats an Nostrum.Struct.Role into a mention.

Link to this section Types

The hexadecimal color code

Whether the role is pinned in the user listing

The id of the role

Whether the role is managed by an integration

Link to this type

mentionable() View Source
mentionable() :: boolean()

Whether the role is mentionable

The name of the role

Link to this type

permissions() View Source
permissions() :: integer()

The permission bit set

Link to this type

position() View Source
position() :: integer()

The position of the role

Link to this type

t() View Source
t() :: %Nostrum.Struct.Guild.Role{
  color: color(),
  hoist: hoist(),
  id: id(),
  managed: managed(),
  mentionable: mentionable(),
  name: name(),
  permissions: permissions(),
  position: position()
}

Link to this section Functions

Link to this function

mention(role) View Source
mention(t()) :: String.t()

Formats an Nostrum.Struct.Role into a mention.

Examples

iex> role = %Nostrum.Struct.Guild.Role{id: 431886639627763722}
...> Nostrum.Struct.Guild.Role.mention(role)
"<@&431886639627763722>"