crux_structs v0.1.4 Crux.Structs.Channel View Source
Represents a Discord Channel Object.
List of where every property can be present:
| Property | Text (0) | DM (1) | Voice (2) | Group (3) | Category (4) |
|---|---|---|---|---|---|
| id | yes | yes | yes | yes | yes |
| type | 0 | 1 | 2 | 3 | 4 |
| guild_id | yes | no | yes | no | yes |
| position | yes | no | yes | no | yes |
| permission_overwrites | yes | no | yes | no | yes |
| name | yes | no | yes | yes | yes |
| topic | yes | no | yes | no | yes |
| nsfw | yes | no | no | no | no |
| last_message_id | yes | yes | no | yes | no |
| bitrate | no | no | yes | no | no |
| user_limit | no | no | yes | no | no |
| recipients | no | yes (One Element) | no | yes | no |
| icon | no | no | no | yes | no |
| owner_id | no | no | no | yes | no |
| application_id | no | no | no | yes | no |
| parent_id | yes | no | yes | no | no |
| last_pin_timestamp | yes | yes | no | yes | no |
Differences opposed to the Discord API Object:
:recipientsis 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>"