Class TemplateChannel
java.lang.Object
net.dv8tion.jda.api.entities.templates.TemplateChannel
- All Implemented Interfaces:
ISnowflake
POJO for the channels information provided by a template.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents the specificRolepermission overrides that can be set for channels. -
Constructor Summary
ConstructorsConstructorDescriptionTemplateChannel(long id, ChannelType channelType, String name, String topic, int rawPosition, long parentId, boolean news, List<TemplateChannel.PermissionOverride> permissionOverrides, boolean nsfw, int slowmode, int bitrate, int userLimit) -
Method Summary
Modifier and TypeMethodDescriptionintThe audio bitrate of the voice audio that is transmitted in this channel.longThe ids of channels are their position as stored by Discord so this will not look like a typical snowflake.getName()The human readable name of the GuildChannel.longParent Category id of this TemplateChannel.@Unmodifiable List<TemplateChannel.PermissionOverride>Gets all of thePermissionOverridesthat are part of thisTemplateChannel.intThe actual position of theTemplateChannelas stored and given by Discord.intThe slowmode set for this TemplateChannel.As the ids of channels are their position, the date of creation cannot be calculated.getTopic()The topic set for this TemplateChannel.getType()TheChannelTypefor this TemplateChannelintThe maximum amount ofMembersthat can be in this voice channel at once.booleanisNews()Whether or not this channel is considered an Announcement-/News-Channel.booleanisNSFW()Whether or not this channel is considered as "NSFW" (Not-Safe-For-Work).Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.dv8tion.jda.api.entities.ISnowflake
getId
-
Constructor Details
-
TemplateChannel
public TemplateChannel(long id, ChannelType channelType, String name, String topic, int rawPosition, long parentId, boolean news, List<TemplateChannel.PermissionOverride> permissionOverrides, boolean nsfw, int slowmode, int bitrate, int userLimit)
-
-
Method Details
-
getIdLong
public long getIdLong()The ids of channels are their position as stored by Discord so this will not look like a typical snowflake.- Specified by:
getIdLongin interfaceISnowflake- Returns:
- The id of the channel as stored by Discord
-
getTimeCreated
As the ids of channels are their position, the date of creation cannot be calculated.- Specified by:
getTimeCreatedin interfaceISnowflake- Returns:
- OffsetDateTime - Time this entity was created at.
- Throws:
UnsupportedOperationException- The date of creation cannot be calculated.- See Also:
-
getType
TheChannelTypefor this TemplateChannel- Returns:
- The channel type
-
getName
The human readable name of the GuildChannel.
If no name has been set, this returns null.- Returns:
- The name of this GuildChannel
-
getTopic
The topic set for this TemplateChannel.
If no topic has been set or theChannelTypeis notTEXT, this returnsnull.- Returns:
- Possibly-null String containing the topic of this TemplateChannel.
-
getPositionRaw
public int getPositionRaw()The actual position of theTemplateChannelas stored and given by Discord. Channel positions are actually based on a pairing of the creation time (as stored in the snowflake id) and the position. If 2 or more channels share the same position then they are sorted based on their creation date. The more recent a channel was created, the lower it is in the hierarchy.- Returns:
- The true, Discord stored, position of the
TemplateChannel.
-
getParentId
public long getParentId()Parent Category id of this TemplateChannel. Channels don't need to have a parent Category.
Note that a Category channel will always return-1for this method as nested categories are not supported.- Returns:
- The id of the parent Category or
-1if the channel doesn't have a parent Category
-
isNSFW
public boolean isNSFW()Whether or not this channel is considered as "NSFW" (Not-Safe-For-Work).
If theChannelTypeis notTEXT, this returnsfalse.- Returns:
- Whether this TextChannel is considered NSFW or
falseif the channel is not a text channel
-
getSlowmode
public int getSlowmode()The slowmode set for this TemplateChannel.
If slowmode is set this returns anintbetween 1 andTextChannel.MAX_SLOWMODE.
If not set this returns0.Note bots are unaffected by this.
HavingMESSAGE_MANAGEorMANAGE_CHANNELpermission also grants immunity to slowmode.- Returns:
- The slowmode for this TextChannel, between 1 and
TextChannel.MAX_SLOWMODE,0if no slowmode is set.
-
getBitrate
public int getBitrate()The audio bitrate of the voice audio that is transmitted in this channel. While higher bitrates can be sent to this channel, it will be scaled down by the client.
Default and recommended value is 64000- Returns:
- The audio bitrate of this voice channel
-
getUserLimit
public int getUserLimit()The maximum amount ofMembersthat can be in this voice channel at once.
0 - No limit- Returns:
- The maximum amount of members allowed in this channel at once.
-
isNews
public boolean isNews()Whether or not this channel is considered an Announcement-/News-Channel.
These channels can be used to crosspost messages to other guilds by using a follower type webhook.- Returns:
- True, if this is considered a news channel
-
getPermissionOverrides
Gets all of thePermissionOverridesthat are part of thisTemplateChannel.
This will only containRoleoverrides.- Returns:
- Immutable list of all
PermissionOverridesfor thisTemplateChannel.
-