Interface ServerChannel
-
- All Superinterfaces:
Channel,ChannelAttachableListenerManager,ChannelSpecialization,Deletable,DiscordEntity,java.util.Formattable,Nameable,ServerChannelAttachableListenerManager,Specializable<ChannelSpecialization>,Updatable,UpdatableFromCache
- All Known Subinterfaces:
ChannelCategory,RegularServerChannel,ServerForumChannel,ServerStageVoiceChannel,ServerTextChannel,ServerThreadChannel,ServerVoiceChannel,UnknownRegularServerChannel,UnknownServerChannel
public interface ServerChannel extends Channel, Nameable, Deletable, ServerChannelAttachableListenerManager
This class represents a server channel.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default InviteBuildercreateInviteBuilder()Creates an invite builder for this channel.default ServerChannelUpdatercreateUpdater()Create an updater for this channel.default java.util.Optional<? extends ServerChannel>getCurrentCachedInstance()Gets an updated instance of this entity from the cache.java.util.concurrent.CompletableFuture<java.util.Set<RichInvite>>getInvites()Gets the invites of the server.default java.util.concurrent.CompletableFuture<? extends ServerChannel>getLatestInstance()Gets an updated instance of this entity from the cache or from Discord directly.ServergetServer()Gets the server of the channel.default java.util.concurrent.CompletableFuture<java.lang.Void>updateName(java.lang.String name)Updates the name of the channel.-
Methods inherited from interface org.javacord.api.entity.channel.Channel
asCategorizable, asChannelCategory, asPrivateChannel, asRegularServerChannel, asServerChannel, asServerForumChannel, asServerStageVoiceChannel, asServerTextChannel, asServerThreadChannel, asServerVoiceChannel, asTextChannel, asVoiceChannel, canSee, canYouSee, getType
-
Methods inherited from interface org.javacord.api.listener.channel.ChannelAttachableListenerManager
addChannelAttachableListener, getChannelAttachableListeners, removeChannelAttachableListener, 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.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
-
getServer
Server getServer()
Gets the server of the channel.- Returns:
- The server of the channel.
-
createInviteBuilder
default InviteBuilder createInviteBuilder()
Creates an invite builder for this channel.- Returns:
- An invite builder for this channel.
-
getInvites
java.util.concurrent.CompletableFuture<java.util.Set<RichInvite>> getInvites()
Gets the invites of the server.- Returns:
- The invites of the server.
-
createUpdater
default ServerChannelUpdater createUpdater()
Create an updater for this channel.- Returns:
- An updater for this channel.
-
updateName
default java.util.concurrent.CompletableFuture<java.lang.Void> updateName(java.lang.String name)
Updates the name of the channel.If you want to update several settings at once, it's recommended to use the
ServerChannelUpdaterfromcreateUpdater()which provides a better performance!- Parameters:
name- The new name of the channel.- Returns:
- A future to check if the update was successful.
-
getCurrentCachedInstance
default java.util.Optional<? extends ServerChannel> 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 interfaceUpdatableFromCache- Returns:
- The current cached instance.
-
getLatestInstance
default java.util.concurrent.CompletableFuture<? extends ServerChannel> 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 interfaceUpdatable- Specified by:
getLatestInstancein interfaceUpdatableFromCache- Returns:
- The current cached instance.
-
-