Crux vdev Crux.Structs.Member View Source

Represents a Discord Guild Member Object.

Differences opposed to the Discord API Object:

  • :user is just the user id

Link to this section Summary

Functions

Creates a Crux.Structs.Member struct from raw data.

Converts a Crux.Structs.Member into its discord mention format.

Link to this section Types

Link to this type

t() View Source (since 0.1.0)
t() :: %Crux.Structs.Member{
  deaf: boolean() | nil,
  guild_id: Crux.Rest.snowflake() | nil,
  joined_at: String.t(),
  mute: boolean() | nil,
  nick: String.t() | nil,
  roles: MapSet.t(Crux.Rest.snowflake()),
  user: Crux.Rest.snowflake()
}

Link to this section Functions

Link to this function

create(data) View Source (since 0.1.0)
create(data :: map()) :: t()

Creates a Crux.Structs.Member struct from raw data.

Automatically invoked by Crux.Structs.create/2.

Link to this function

to_mention(member) View Source (since 0.1.1)
to_mention(user :: Crux.Structs.Member.t()) :: String.t()

Converts a Crux.Structs.Member into its discord mention format.

Examples

# Without nickname
iex> %Crux.Structs.Member{user: 218348062828003328, nick: nil}
...> |> Crux.Structs.Member.to_mention()
"<@218348062828003328>"

# With nickname
iex> %Crux.Structs.Member{user: 218348062828003328, nick: "weltraum"}
...> |> Crux.Structs.Member.to_mention()
"<@!218348062828003328>"