Crux vdev 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)News (5)
application_idnononoyesnono
bitratenonoyesnonono
guild_idyesnoyesnoyesyes
iconnononoyesnono
idyesyesyesyesyesyes
last_message_idyesyesnoyesnoyes
last_pin_timestampyesyesnoyesnoyes
nameyesnoyesyesyesyes
nsfwyesnonononoyes
owner_idnononoyesnono
parent_idyesnoyesnonoyes
permission_overwritesyesnoyesnoyesyes
positionyesnoyesnoyesyes
rate_limit_per_useryesnonononono
recipientsnoyes
(One Element)
noyesnono
topicyesnoyesnoyesyes
type012345
user_limitnonoyesnonono

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 (since 0.1.0)
t() :: %Crux.Structs.Channel{
  application_id: Crux.Rest.snowflake(),
  bitrate: integer(),
  guild_id: Crux.Rest.snowflake(),
  icon: String.t(),
  id: Crux.Rest.snowflake(),
  last_message_id: Crux.Rest.snowflake(),
  last_pin_timestamp: String.t(),
  name: String.t(),
  nsfw: boolean(),
  owner_id: Crux.Rest.snowflake(),
  parent_id: Crux.Rest.snowflake(),
  permission_overwrites: %{
    optional(Crux.Rest.snowflake()) => Crux.Structs.Overwrite.t()
  },
  position: integer(),
  rate_limit_per_user: integer(),
  recipients: MapSet.t(Crux.Rest.snowflake()),
  topic: String.t(),
  type: integer(),
  user_limit: non_neg_integer()
}

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.Channel struct from raw data.

Automatically invoked by Crux.Structs.create/2

Link to this function

to_mention(channel) View Source (since 0.1.1)
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>"