Nostrum v0.4.0 Nostrum.Struct.Channel View Source
Struct representing a Discord guild channel.
A Nostrum.Struct.Channel
represents all 5 types of channels. Each
channel has a field :type
with any of the following values:
0
- GUILD_TEXT1
- DM2
- GUILD_VOICE3
- GROUP_DM4
- GUILD_CATEGORY
More information can be found on the Discord API Channel Documentation.
Mentioning Channels in Messages
A Nostrum.Struct.Channel
can be mentioned in message content using the String.Chars
protocol or mention/1
.
channel = %Nostrum.Struct.Channel{id: 381889573426429952}
Nostrum.Api.create_message!(184046599834435585, "#{channel}")
%Nostrum.Struct.Message{content: "<#381889573426429952>"}
channel = %Nostrum.Struct.Channel{id: 280085880452939778}
Nostrum.Api.create_message!(280085880452939778, "#{Nostrum.Struct.Channel.mention(channel)}")
%Nostrum.Struct.Message{content: "<#280085880452939778>"}
Link to this section Summary
Types
The application id of the group DM creator if it is bot-created
The bitrate of the voice channel
A Nostrum.Struct.Channel
that represents a channel category in a guild.
A Nostrum.Struct.Channel
that represents a DM channel.
A Nostrum.Struct.Channel
that represents a group DM channel.
A Nostrum.Struct.Channel
that represents a channel in a guild.
The id of the channel's guild
A Nostrum.Struct.Channel
that represents a text channel in a guild.
A Nostrum.Struct.Channel
that represents a voice channel in a guild.
The icon hash of the channel
The channel's id
Id of the last message sent
When the last pinned message was pinned
The name of the channel
If the channel is nsfw
The id of the DM creator
The id of the parent category for a channel
The list of overwrites
The ordered position of the channel
The recipients of the DM
A Nostrum.Struct.Channel
that represents a text channel.
Current channel topic
The user limit of the voice channel
A Nostrum.Struct.Channel
that represents a voice channel.
Functions
Formats a Nostrum.Struct.Channel
into a mention.
Link to this section Types
application_id()
View Source
application_id() :: Nostrum.Snowflake.t() | nil
application_id() :: Nostrum.Snowflake.t() | nil
The application id of the group DM creator if it is bot-created
bitrate()
View Source
bitrate() :: integer()
bitrate() :: integer()
The bitrate of the voice channel
channel_category()
View Source
channel_category() :: %Nostrum.Struct.Channel{
application_id: nil,
bitrate: nil,
guild_id: guild_id(),
icon: nil,
id: id(),
last_message_id: nil,
last_pin_timestamp: nil,
name: name(),
nsfw: nsfw(),
owner_id: nil,
parent_id: parent_id(),
permission_overwrites: permission_overwrites(),
position: position(),
recipients: nil,
topic: nil,
type: 4,
user_limit: nil
}
channel_category() :: %Nostrum.Struct.Channel{ application_id: nil, bitrate: nil, guild_id: guild_id(), icon: nil, id: id(), last_message_id: nil, last_pin_timestamp: nil, name: name(), nsfw: nsfw(), owner_id: nil, parent_id: parent_id(), permission_overwrites: permission_overwrites(), position: position(), recipients: nil, topic: nil, type: 4, user_limit: nil }
A Nostrum.Struct.Channel
that represents a channel category in a guild.
dm_channel()
View Source
dm_channel() :: %Nostrum.Struct.Channel{
application_id: nil,
bitrate: nil,
guild_id: nil,
icon: nil,
id: id(),
last_message_id: last_message_id(),
last_pin_timestamp: nil,
name: nil,
nsfw: nil,
owner_id: nil,
parent_id: nil,
permission_overwrites: nil,
position: nil,
recipients: recipients(),
topic: nil,
type: 1,
user_limit: nil
}
dm_channel() :: %Nostrum.Struct.Channel{ application_id: nil, bitrate: nil, guild_id: nil, icon: nil, id: id(), last_message_id: last_message_id(), last_pin_timestamp: nil, name: nil, nsfw: nil, owner_id: nil, parent_id: nil, permission_overwrites: nil, position: nil, recipients: recipients(), topic: nil, type: 1, user_limit: nil }
A Nostrum.Struct.Channel
that represents a DM channel.
group_dm_channel()
View Source
group_dm_channel() :: %Nostrum.Struct.Channel{
application_id: application_id(),
bitrate: nil,
guild_id: nil,
icon: icon(),
id: id(),
last_message_id: last_message_id(),
last_pin_timestamp: nil,
name: name(),
nsfw: nil,
owner_id: owner_id(),
parent_id: nil,
permission_overwrites: nil,
position: nil,
recipients: recipients(),
topic: nil,
type: 3,
user_limit: nil
}
group_dm_channel() :: %Nostrum.Struct.Channel{ application_id: application_id(), bitrate: nil, guild_id: nil, icon: icon(), id: id(), last_message_id: last_message_id(), last_pin_timestamp: nil, name: name(), nsfw: nil, owner_id: owner_id(), parent_id: nil, permission_overwrites: nil, position: nil, recipients: recipients(), topic: nil, type: 3, user_limit: nil }
A Nostrum.Struct.Channel
that represents a group DM channel.
guild_channel()
View Source
guild_channel() ::
guild_text_channel() | guild_voice_channel() | channel_category()
guild_channel() :: guild_text_channel() | guild_voice_channel() | channel_category()
A Nostrum.Struct.Channel
that represents a channel in a guild.
guild_id()
View Source
guild_id() :: Nostrum.Snowflake.t()
guild_id() :: Nostrum.Snowflake.t()
The id of the channel's guild
guild_text_channel()
View Source
guild_text_channel() :: %Nostrum.Struct.Channel{
application_id: nil,
bitrate: nil,
guild_id: guild_id(),
icon: nil,
id: id(),
last_message_id: last_message_id(),
last_pin_timestamp: last_pin_timestamp(),
name: name(),
nsfw: nsfw(),
owner_id: nil,
parent_id: parent_id(),
permission_overwrites: permission_overwrites(),
position: position(),
recipients: nil,
topic: topic(),
type: 0,
user_limit: nil
}
guild_text_channel() :: %Nostrum.Struct.Channel{ application_id: nil, bitrate: nil, guild_id: guild_id(), icon: nil, id: id(), last_message_id: last_message_id(), last_pin_timestamp: last_pin_timestamp(), name: name(), nsfw: nsfw(), owner_id: nil, parent_id: parent_id(), permission_overwrites: permission_overwrites(), position: position(), recipients: nil, topic: topic(), type: 0, user_limit: nil }
A Nostrum.Struct.Channel
that represents a text channel in a guild.
guild_voice_channel()
View Source
guild_voice_channel() :: %Nostrum.Struct.Channel{
application_id: nil,
bitrate: bitrate(),
guild_id: guild_id(),
icon: nil,
id: id(),
last_message_id: nil,
last_pin_timestamp: nil,
name: name(),
nsfw: nsfw(),
owner_id: nil,
parent_id: parent_id(),
permission_overwrites: permission_overwrites(),
position: position(),
recipients: nil,
topic: nil,
type: 2,
user_limit: user_limit()
}
guild_voice_channel() :: %Nostrum.Struct.Channel{ application_id: nil, bitrate: bitrate(), guild_id: guild_id(), icon: nil, id: id(), last_message_id: nil, last_pin_timestamp: nil, name: name(), nsfw: nsfw(), owner_id: nil, parent_id: parent_id(), permission_overwrites: permission_overwrites(), position: position(), recipients: nil, topic: nil, type: 2, user_limit: user_limit() }
A Nostrum.Struct.Channel
that represents a voice channel in a guild.
icon()
View Source
icon() :: String.t() | nil
icon() :: String.t() | nil
The icon hash of the channel
id()
View Source
id() :: Nostrum.Snowflake.t()
id() :: Nostrum.Snowflake.t()
The channel's id
last_message_id()
View Source
last_message_id() :: Nostrum.Snowflake.t() | nil
last_message_id() :: Nostrum.Snowflake.t() | nil
Id of the last message sent
last_pin_timestamp()
View Source
last_pin_timestamp() :: String.t() | nil
last_pin_timestamp() :: String.t() | nil
When the last pinned message was pinned
name()
View Source
name() :: String.t()
name() :: String.t()
The name of the channel
nsfw()
View Source
nsfw() :: boolean()
nsfw() :: boolean()
If the channel is nsfw
owner_id()
View Source
owner_id() :: Nostrum.Snowflake.t()
owner_id() :: Nostrum.Snowflake.t()
The id of the DM creator
parent_id()
View Source
parent_id() :: Nostrum.Snowflake.t() | nil
parent_id() :: Nostrum.Snowflake.t() | nil
The id of the parent category for a channel
permission_overwrites()
View Source
permission_overwrites() :: [Nostrum.Struct.Overwrite.t()]
permission_overwrites() :: [Nostrum.Struct.Overwrite.t()]
The list of overwrites
position()
View Source
position() :: integer()
position() :: integer()
The ordered position of the channel
recipients()
View Source
recipients() :: [Nostrum.Struct.User.t()]
recipients() :: [Nostrum.Struct.User.t()]
The recipients of the DM
t()
View Source
t() ::
guild_text_channel()
| dm_channel()
| guild_voice_channel()
| group_dm_channel()
| channel_category()
t() :: guild_text_channel() | dm_channel() | guild_voice_channel() | group_dm_channel() | channel_category()
text_channel()
View Source
text_channel() :: guild_text_channel() | dm_channel() | group_dm_channel()
text_channel() :: guild_text_channel() | dm_channel() | group_dm_channel()
A Nostrum.Struct.Channel
that represents a text channel.
topic()
View Source
topic() :: String.t()
topic() :: String.t()
Current channel topic
user_limit()
View Source
user_limit() :: integer()
user_limit() :: integer()
The user limit of the voice channel
voice_channel()
View Source
voice_channel() :: guild_voice_channel()
voice_channel() :: guild_voice_channel()
A Nostrum.Struct.Channel
that represents a voice channel.
Link to this section Functions
mention(channel) View Source
Formats a Nostrum.Struct.Channel
into a mention.
Examples
iex> channel = %Nostrum.Struct.Channel{id: 381889573426429952}
...> Nostrum.Struct.Channel.mention(channel)
"<#381889573426429952>"