Interface Category
-
- All Superinterfaces:
AbstractChannel,java.lang.Comparable<GuildChannel>,java.util.Formattable,GuildChannel,IMentionable,ISnowflake
public interface Category extends GuildChannel
Represents a channel category in the official Discord API.
Categories are used to keep order in a Guild by dividing the channels into groups.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ChannelAction<Category>createCopy()Creates a copy of the specifiedGuildChannel.ChannelAction<Category>createCopy(Guild guild)Creates a copy of the specifiedGuildChannelin the specifiedGuild.ChannelAction<StageChannel>createStageChannel(java.lang.String name)Creates a newStageChannelwith this Category as parent.ChannelAction<TextChannel>createTextChannel(java.lang.String name)Creates a newTextChannelwith this Category as parent.ChannelAction<VoiceChannel>createVoiceChannel(java.lang.String name)Creates a newVoiceChannelwith this Category as parent.java.util.List<GuildChannel>getChannels()AllChannelslisted for this Category
This may containVoiceChannels,StoreChannels, andTextChannels!java.util.List<StoreChannel>getStoreChannels()AllStoreChannelslisted for this Categoryjava.util.List<TextChannel>getTextChannels()AllTextChannelslisted for this Categoryjava.util.List<VoiceChannel>getVoiceChannels()AllVoiceChannelslisted for this CategoryCategoryOrderActionmodifyTextChannelPositions()Modifies the positional order of this Category's nestedTextChannelsandStoreChannels.CategoryOrderActionmodifyVoiceChannelPositions()Modifies the positional order of this Category's nestedVoiceChannels.-
Methods inherited from interface net.dv8tion.jda.api.entities.AbstractChannel
getJDA, getName, getType
-
Methods inherited from interface net.dv8tion.jda.api.entities.GuildChannel
createInvite, createPermissionOverride, delete, getGuild, getManager, getMemberPermissionOverrides, getMembers, getParent, getPermissionOverride, getPermissionOverrides, getPosition, getPositionRaw, getRolePermissionOverrides, isSynced, putPermissionOverride, retrieveInvites, upsertPermissionOverride
-
Methods inherited from interface net.dv8tion.jda.api.entities.IMentionable
formatTo, getAsMention
-
Methods inherited from interface net.dv8tion.jda.api.entities.ISnowflake
getId, getIdLong, getTimeCreated
-
-
-
-
Method Detail
-
getChannels
@Nonnull java.util.List<GuildChannel> getChannels()
AllChannelslisted for this Category
This may containVoiceChannels,StoreChannels, andTextChannels!- Returns:
- Immutable list of all child channels
-
getStoreChannels
@Nonnull java.util.List<StoreChannel> getStoreChannels()
AllStoreChannelslisted for this Category- Returns:
- Immutable list of all child StoreChannels
- Since:
- 4.0.0
-
getTextChannels
@Nonnull java.util.List<TextChannel> getTextChannels()
AllTextChannelslisted for this Category- Returns:
- Immutable list of all child TextChannels
-
getVoiceChannels
@Nonnull java.util.List<VoiceChannel> getVoiceChannels()
AllVoiceChannelslisted for this Category- Returns:
- Immutable list of all child VoiceChannels
-
createTextChannel
@Nonnull @CheckReturnValue ChannelAction<TextChannel> createTextChannel(@Nonnull java.lang.String name)
Creates a newTextChannelwith this Category as parent. For this to be successful, the logged in account has to have theMANAGE_CHANNELPermission in this Category.This will copy all
PermissionOverridesof this Category! Unless the bot is unable to sync it with this category due to permission escalation. SeeIPermissionHolder.canSync(GuildChannel, GuildChannel)for details.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The channel could not be created due to a permission discrepancyMISSING_ACCESS
TheVIEW_CHANNELpermission was removedMAX_CHANNELS
The maximum number of channels were exceeded
- Parameters:
name- The name of the TextChannel to create- Returns:
- A specific
ChannelAction
This action allows to set fields for the new TextChannel before creating it - Throws:
InsufficientPermissionException- If the logged in account does not have thePermission.MANAGE_CHANNELpermissionjava.lang.IllegalArgumentException- If the provided name isnullor empty or greater than 100 characters in length
-
createVoiceChannel
@Nonnull @CheckReturnValue ChannelAction<VoiceChannel> createVoiceChannel(@Nonnull java.lang.String name)
Creates a newVoiceChannelwith this Category as parent. For this to be successful, the logged in account has to have theMANAGE_CHANNELPermission in this Category.This will copy all
PermissionOverridesof this Category! Unless the bot is unable to sync it with this category due to permission escalation. SeeIPermissionHolder.canSync(GuildChannel, GuildChannel)for details.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The channel could not be created due to a permission discrepancyMISSING_ACCESS
TheVIEW_CHANNELpermission was removedMAX_CHANNELS
The maximum number of channels were exceeded
- Parameters:
name- The name of the VoiceChannel to create- Returns:
- A specific
ChannelAction
This action allows to set fields for the new VoiceChannel before creating it - Throws:
InsufficientPermissionException- If the logged in account does not have thePermission.MANAGE_CHANNELpermissionjava.lang.IllegalArgumentException- If the provided name isnullor empty or greater than 100 characters in length
-
createStageChannel
@Nonnull @CheckReturnValue ChannelAction<StageChannel> createStageChannel(@Nonnull java.lang.String name)
Creates a newStageChannelwith this Category as parent. For this to be successful, the logged in account has to have theMANAGE_CHANNELPermission in this Category.This will copy all
PermissionOverridesof this Category! Unless the bot is unable to sync it with this category due to permission escalation. SeeIPermissionHolder.canSync(GuildChannel, GuildChannel)for details.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The channel could not be created due to a permission discrepancyMISSING_ACCESS
TheVIEW_CHANNELpermission was removedMAX_CHANNELS
The maximum number of channels were exceeded
- Parameters:
name- The name of the StageChannel to create- Returns:
- A specific
ChannelAction
This action allows to set fields for the new StageChannel before creating it - Throws:
InsufficientPermissionException- If the logged in account does not have thePermission.MANAGE_CHANNELpermissionjava.lang.IllegalArgumentException- If the provided name isnullor empty or greater than 100 characters in length
-
modifyTextChannelPositions
@Nonnull @CheckReturnValue CategoryOrderAction modifyTextChannelPositions()
Modifies the positional order of this Category's nestedTextChannelsandStoreChannels.
This uses an extension ofChannelOrderActionspecialized for ordering the nestedTextChannelsandStoreChannelsof thisCategory.
LikeChannelOrderAction, the returnedCategoryOrderActioncan be used to move TextChannels/StoreChannelsup,down, ortoa specific position.
This uses ascending order with a 0 based index.Possible
ErrorResponsesinclude:UNNKOWN_CHANNEL
One of the channels has been deleted before the completion of the task.MISSING_ACCESS
The currently logged in account was removed from the Guild.
- Returns:
- A
CategoryOrderActionfor ordering the Category'sTextChannelsandStoreChannels.
-
modifyVoiceChannelPositions
@Nonnull @CheckReturnValue CategoryOrderAction modifyVoiceChannelPositions()
Modifies the positional order of this Category's nestedVoiceChannels.
This uses an extension ofChannelOrderActionspecialized for ordering the nestedVoiceChannelsof thisCategory.
LikeChannelOrderAction, the returnedCategoryOrderActioncan be used to move VoiceChannelsup,down, ortoa specific position.
This uses ascending order with a 0 based index.Possible
ErrorResponsesinclude:UNNKOWN_CHANNEL
One of the channels has been deleted before the completion of the task.MISSING_ACCESS
The currently logged in account was removed from the Guild.
- Returns:
- A
CategoryOrderActionfor ordering the Category'sVoiceChannels.
-
createCopy
@Nonnull ChannelAction<Category> createCopy(@Nonnull Guild guild)
Description copied from interface:GuildChannelCreates a copy of the specifiedGuildChannelin the specifiedGuild.
If the provided target guild is not the same Guild this channel is in then the parent category and permissions will not be copied due to technical difficulty and ambiguity.This copies the following elements:
- Name
- Parent Category (if present)
- Voice Elements (Bitrate, Userlimit)
- Text Elements (Topic, NSFW, Slowmode)
- All permission overrides for Members/Roles
Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The channel could not be created due to a permission discrepancyMISSING_ACCESS
TheVIEW_CHANNELpermission was removed
- Specified by:
createCopyin interfaceGuildChannel- Parameters:
guild- TheGuildto create the channel in- Returns:
- A specific
ChannelAction
This action allows to set fields for the new GuildChannel before creating it!
-
createCopy
@Nonnull ChannelAction<Category> createCopy()
Description copied from interface:GuildChannelCreates a copy of the specifiedGuildChannel.This copies the following elements:
- Name
- Parent Category (if present)
- Voice Elements (Bitrate, Userlimit)
- Text Elements (Topic, NSFW, Slowmode)
- All permission overrides for Members/Roles
Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The channel could not be created due to a permission discrepancyMISSING_ACCESS
TheVIEW_CHANNELpermission was removed
- Specified by:
createCopyin interfaceGuildChannel- Returns:
- A specific
ChannelAction
This action allows to set fields for the new GuildChannel before creating it!
-
-