crux_structs v0.1.3 Crux.Structs.Channel View Source

Represents a Discord Channel Object.

List of where every property can be present:

PropertyText (0)DM (1)Voice (2)Group (3)Category (4)
idyesyesyesyesyes
type01234
guild_idyesnoyesnoyes
positionyesnoyesnoyes
permission_overwritesyesnoyesnoyes
nameyesnoyesyesyes
topicyesnoyesnoyes
nsfwyesnononono
last_message_idyesyesnoyesno
bitratenonoyesnono
user_limitnonoyesnono
recipientsnoyes
(One Element)
noyesno
iconnononoyesno
owner_idnononoyesno
application_idnononoyesno
parent_idyesnoyesnono
last_pin_timestampyesyesnoyesno

Differences opposed to the Discord API Object:

  • :recipients is a MapSet of user ids

Link to this section Summary

Functions

Creates a Crux.Structs.Channel struct from raw data

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

Link to this section Types

Link to this type t() View Source
t() :: %Crux.Structs.Channel{
  application_id: integer(),
  bitrate: term(),
  guild_id: integer(),
  icon: String.t(),
  id: integer(),
  last_message_id: term(),
  last_pin_timestamp: String.t(),
  name: String.t(),
  nsfw: boolean(),
  owner_id: integer(),
  parent_id: integer(),
  permission_overwrites: %{optional(integer()) => Crux.Structs.Overwrite.t()},
  position: integer(),
  recipients: MapSet.t(integer()),
  topic: String.t(),
  type: integer(),
  user_limit: non_neg_integer()
}

Link to this section Functions

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

Automatically invoked by Crux.Structs.create/2

Link to this function to_mention(channel) View Source
to_mention(user :: Crux.Structs.Channel.t()) :: String.t()

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

Example

iex> %Crux.Structs.Channel{id: 316880197314019329}
...> |> Crux.Structs.Channel.to_mention()
"<#316880197314019329>"