Package org.javacord.api.entity.channel
Interface ChannelCategory
-
- All Superinterfaces:
Channel,ChannelAttachableListenerManager,ChannelCategoryAttachableListenerManager,ChannelSpecialization,java.lang.Comparable<RegularServerChannel>,Deletable,DiscordEntity,java.util.Formattable,Nameable,RegularServerChannel,ServerChannel,ServerChannelAttachableListenerManager,Specializable<ChannelSpecialization>,Updatable,UpdatableFromCache
public interface ChannelCategory extends RegularServerChannel, ChannelCategoryAttachableListenerManager
This class represents a channel category.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default java.util.concurrent.CompletableFuture<java.lang.Void>addCategorizable(Categorizable categorizable)Adds a categorizable to this category.default booleancanSeeAll(User user)Checks if the given user can see all channels in this category.default booleancanYouSeeAll()Checks if the user of the connected account can see all channels in this category.java.util.List<RegularServerChannel>getChannels()Gets a sorted (by position) list with all channels which this category contains.default java.util.Optional<ChannelCategory>getCurrentCachedInstance()Gets an updated instance of this entity from the cache.default java.util.concurrent.CompletableFuture<ChannelCategory>getLatestInstance()Gets an updated instance of this entity from the cache or from Discord directly.default ChannelTypegetType()Gets the type of the channel.default java.util.List<ServerChannel>getVisibleChannels(User user)Gets a sorted (by position) list with all channels in this category the given user can see.booleanisNsfw()Checks is the category is "not safe for work".default java.util.concurrent.CompletableFuture<java.lang.Void>removeCategorizable(Categorizable categorizable)Removes a categorizable from this category.-
Methods inherited from interface org.javacord.api.entity.channel.Channel
asCategorizable, asChannelCategory, asPrivateChannel, asRegularServerChannel, asServerChannel, asServerForumChannel, asServerStageVoiceChannel, asServerTextChannel, asServerThreadChannel, asServerVoiceChannel, asTextChannel, asVoiceChannel, canSee, canYouSee
-
Methods inherited from interface org.javacord.api.listener.channel.ChannelAttachableListenerManager
addChannelAttachableListener, getChannelAttachableListeners, removeChannelAttachableListener, removeListener
-
Methods inherited from interface org.javacord.api.listener.channel.server.ChannelCategoryAttachableListenerManager
addChannelCategoryAttachableListener, addServerChannelChangeNsfwFlagListener, getChannelCategoryAttachableListeners, getServerChannelChangeNsfwFlagListeners, removeChannelCategoryAttachableListener, removeListener
-
Methods inherited from interface org.javacord.api.entity.Deletable
delete, delete, deleteAfter, deleteAfter, deleteAfter, deleteAfter, getApi
-
Methods inherited from interface org.javacord.api.entity.DiscordEntity
getApi, getCreationTimestamp, getId, getIdAsString
-
Methods inherited from interface org.javacord.api.entity.channel.RegularServerChannel
canCreateInstantInvite, canYouCreateInstantInvite, compareTo, createUpdater, getEffectiveAllowedPermissions, getEffectiveDeniedPermissions, getEffectiveOverwrittenPermissions, getEffectivePermissions, getOverwrittenPermissions, getOverwrittenPermissions, getOverwrittenRolePermissions, getOverwrittenUserPermissions, getPosition, getRawPosition, hasAnyPermission, hasPermission, hasPermissions, updateRawPosition
-
Methods inherited from interface org.javacord.api.entity.channel.ServerChannel
createInviteBuilder, getInvites, getServer, updateName
-
Methods inherited from interface org.javacord.api.listener.channel.server.ServerChannelAttachableListenerManager
addServerChannelAttachableListener, addServerChannelChangeNameListener, addServerChannelChangeOverwrittenPermissionsListener, addServerChannelChangePositionListener, addServerChannelDeleteListener, addVoiceStateUpdateListener, getServerChannelAttachableListeners, getServerChannelChangeNameListeners, getServerChannelChangeOverwrittenPermissionsListeners, getServerChannelChangePositionListeners, getServerChannelDeleteListeners, getVoiceStateUpdateListeners, removeListener, removeServerChannelAttachableListener
-
Methods inherited from interface org.javacord.api.util.Specializable
as
-
-
-
-
Method Detail
-
getType
default ChannelType getType()
Description copied from interface:ChannelGets the type of the channel.
-
getChannels
java.util.List<RegularServerChannel> getChannels()
Gets a sorted (by position) list with all channels which this category contains.- Returns:
- All channels which this category contains.
-
getVisibleChannels
default java.util.List<ServerChannel> getVisibleChannels(User user)
Gets a sorted (by position) list with all channels in this category the given user can see.- Parameters:
user- The user to check.- Returns:
- The visible channels in the category.
-
canSeeAll
default boolean canSeeAll(User user)
Checks if the given user can see all channels in this category.- Parameters:
user- The user to check.- Returns:
- Whether the given user can see all channels in this category or not.
-
canYouSeeAll
default boolean canYouSeeAll()
Checks if the user of the connected account can see all channels in this category.- Returns:
- Whether the user of the connected account can see all channels in this category or not.
-
isNsfw
boolean isNsfw()
Checks is the category is "not safe for work".- Returns:
- Whether the category is "not safe for work" or not.
-
addCategorizable
default java.util.concurrent.CompletableFuture<java.lang.Void> addCategorizable(Categorizable categorizable)
Adds a categorizable to this category.- Parameters:
categorizable- The categorizable to add.- Returns:
- A future to check if the update was successful.
-
removeCategorizable
default java.util.concurrent.CompletableFuture<java.lang.Void> removeCategorizable(Categorizable categorizable)
Removes a categorizable from this category.- Parameters:
categorizable- The categorizable to remove.- Returns:
- A future to check if the update was successful.
-
getCurrentCachedInstance
default java.util.Optional<ChannelCategory> getCurrentCachedInstance()
Description copied from interface:UpdatableFromCacheGets an updated instance of this entity from the cache. This is for example necessary if an instance got invalid by a reconnect to Discord which invalidates all existing instances which means they do not get any further updates from Discord applied. Due to that, references to instances should usually not be held for an extended period of time. If they are, this method can be used to retrieve the current instance from the cache, that gets updates from Discord, in case this one was invalidated.This method returns the currently cached entity, or an empty
Optionalif the entity is not cached any longer, for example because it was deleted or the message was thrown out of the cache.- Specified by:
getCurrentCachedInstancein interfaceChannel- Specified by:
getCurrentCachedInstancein interfaceRegularServerChannel- Specified by:
getCurrentCachedInstancein interfaceServerChannel- Specified by:
getCurrentCachedInstancein interfaceUpdatableFromCache- Returns:
- The current cached instance.
-
getLatestInstance
default java.util.concurrent.CompletableFuture<ChannelCategory> getLatestInstance()
Description copied from interface:UpdatableGets an updated instance of this entity from the cache or from Discord directly. This is for example necessary if an instance got invalid by a reconnect to Discord which invalidates all existing instances which means they do not get any further updates from Discord applied. Due to that, references to instances should usually not be held for an extended period of time. If they are, this method can be used to retrieve the current instance from the cache if present or from Discord directly.This method returns the currently cached entity if present, or request the entity from Discord if it is not cached or not permanently cached. If the entity is a fully cached entity and is not in the cache any longer, for example because it was deleted or the message was thrown out of the cache, the
CompletableFuturecompletes exceptionally with aNoSuchElementException. If a request to Discord is made, the according remote call exception will be used to complete theCompletableFutureexceptionally.- Specified by:
getLatestInstancein interfaceChannel- Specified by:
getLatestInstancein interfaceRegularServerChannel- Specified by:
getLatestInstancein interfaceServerChannel- Specified by:
getLatestInstancein interfaceUpdatable- Specified by:
getLatestInstancein interfaceUpdatableFromCache- Returns:
- The current cached instance.
-
-