Enum ChannelType
- All Implemented Interfaces:
Serializable
,Comparable<ChannelType>
Enum used to differentiate between the different types of Discord channels.
-
Enum Constant Summary
Enum ConstantDescriptionACategory
, Guild-Only.AForumChannel
, Guild-Only.A Group.AMediaChannel
, Guild-Only.ANewsChannel
, Guild-Only.AStageChannel
, Guild-Only.ATextChannel
, Guild-Only.Unknown Discord channel type.AVoiceChannel
, Guild-Only. -
Method Summary
Modifier and TypeMethodDescriptionstatic ChannelType
fromId
(int id) Static accessor for retrieving a channel type based on its Discord id key.static EnumSet<ChannelType>
fromSortBucket
(int bucket) AnEnumSet
populated with all channel types using the provided sorting bucket.int
getId()
The Discord id key used to represent the channel type.The interface this channel type corresponds to.int
The sorting bucket for this channel type.static EnumSet<ChannelType>
All the channel types for aGuild
.boolean
isAudio()
Whether channels of this type support audio connections.boolean
isGuild()
Whether this ChannelType is present for aGuildChannel
boolean
Whether channels of this type support message sending.boolean
isThread()
Whether channels of this type areThreadChannels
.static ChannelType
Returns the enum constant of this type with the specified name.static ChannelType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
TEXT
ATextChannel
, Guild-Only. -
PRIVATE
-
VOICE
AVoiceChannel
, Guild-Only. -
GROUP
A Group. (unused) -
CATEGORY
ACategory
, Guild-Only. -
NEWS
ANewsChannel
, Guild-Only. -
STAGE
AStageChannel
, Guild-Only. -
GUILD_NEWS_THREAD
-
GUILD_PUBLIC_THREAD
-
GUILD_PRIVATE_THREAD
-
FORUM
AForumChannel
, Guild-Only. -
MEDIA
AMediaChannel
, Guild-Only. -
UNKNOWN
Unknown Discord channel type.This might be used in the case when a channel is not available in cache, like when sending webhook messages.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
getInterface
The interface this channel type corresponds to.- Returns:
- This channel type's interface
-
getSortBucket
public int getSortBucket()The sorting bucket for this channel type.- Returns:
- The sorting bucket
-
getId
public int getId()The Discord id key used to represent the channel type.- Returns:
- The id key used by discord for this channel type.
-
isGuild
public boolean isGuild()Whether this ChannelType is present for aGuildChannel
- Returns:
- Whether or not this a GuildChannel
-
isAudio
public boolean isAudio()Whether channels of this type support audio connections.- Returns:
- True, if channels of this type support audio
-
isMessage
public boolean isMessage()Whether channels of this type support message sending.- Returns:
- True, if channels of this type support messages
-
isThread
public boolean isThread()Whether channels of this type areThreadChannels
. This mostly exists to make handling threads simpler than having to check 3 separate ChannelTypes every time.- Returns:
- True, if channels of this type are
ThreadChannel
-
guildTypes
All the channel types for aGuild
.- Returns:
EnumSet
ofChannelType
-
fromId
Static accessor for retrieving a channel type based on its Discord id key.- Parameters:
id
- The id key of the requested channel type.- Returns:
- The ChannelType that is referred to by the provided key. If the id key is unknown,
UNKNOWN
is returned.
-
fromSortBucket
AnEnumSet
populated with all channel types using the provided sorting bucket.- Parameters:
bucket
- The sorting bucket- Returns:
- Possibly-empty
EnumSet
for the bucket
-