Interface ServerVoiceChannel
-
- All Superinterfaces:
Categorizable,Channel,ChannelAttachableListenerManager,ChannelSpecialization,Comparable<T>,DiscordEntity,Formattable,Nameable,ServerChannel,ServerChannelAttachableListenerManager,ServerVoiceChannelAttachableListenerManager,Specializable<T>,Updatable<T>,UpdatableFromCache,VoiceChannel,VoiceChannelAttachableListenerManager
- All Known Subinterfaces:
ServerStageVoiceChannel
public interface ServerVoiceChannel extends ServerChannel, VoiceChannel, Categorizable, ServerVoiceChannelAttachableListenerManager
This class represents a server voice channel.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description CompletableFuture<AudioConnection>connect()Connects to the voice channel and disconnects any existing connections in the server.default ServerVoiceChannelUpdatercreateUpdater()Creates an updater for this channel.intgetBitrate()Gets the bitrate (int bits) of the channel.Collection<Long>getConnectedUserIds()Gets the ids of the users that are connected to this server voice channel.Collection<User>getConnectedUsers()Gets the users that are connected to this server voice channel.default Optional<ServerVoiceChannel>getCurrentCachedInstance()Gets an updated instance of this entity from the cache.default CompletableFuture<ServerVoiceChannel>getLatestInstance()Gets an updated instance of this entity from the cache or from Discord directly.default ChannelTypegetType()Gets the type of the channel.Optional<Integer>getUserLimit()Gets the user limit of the channel.booleanisConnected(long userId)Checks whether the user with the given id is connected to this channel.default booleanisConnected(User user)Checks whether the given user is connected to this channel.default CompletableFuture<Void>removeCategory()Removes the category of the channel.default CompletableFuture<Void>removeUserLimit()Removes the user limit of the channel.default CompletableFuture<Void>updateBitrate(int bitrate)Updates the bitrate of the channel.default CompletableFuture<Void>updateCategory(ChannelCategory category)Updates the category of the channel.default CompletableFuture<Void>updateUserLimit(int userLimit)Updates the user limit of the channel.-
Methods inherited from interface org.javacord.api.entity.channel.Categorizable
getCategory
-
Methods inherited from interface org.javacord.api.entity.channel.Channel
asCategorizable, asChannelCategory, asGroupChannel, asPrivateChannel, asServerChannel, asServerStageVoiceChannel, asServerTextChannel, 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.entity.DiscordEntity
getApi, getCreationTimestamp, getCreationTimestamp, getId, getIdAsString
-
Methods inherited from interface org.javacord.api.entity.channel.ServerChannel
canCreateInstantInvite, canYouCreateInstantInvite, compareTo, createInviteBuilder, delete, delete, getEffectiveAllowedPermissions, getEffectiveDeniedPermissions, getEffectiveOverwrittenPermissions, getEffectivePermissions, getInvites, getOverwrittenPermissions, getOverwrittenPermissions, getOverwrittenRolePermissions, getOverwrittenUserPermissions, getPosition, getRawPosition, getServer, hasAnyPermission, hasPermission, hasPermissions, updateName, updateRawPosition
-
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.listener.channel.server.voice.ServerVoiceChannelAttachableListenerManager
addServerVoiceChannelAttachableListener, addServerVoiceChannelChangeBitrateListener, addServerVoiceChannelChangeUserLimitListener, addServerVoiceChannelMemberJoinListener, addServerVoiceChannelMemberLeaveListener, getServerVoiceChannelAttachableListeners, getServerVoiceChannelChangeBitrateListeners, getServerVoiceChannelChangeUserLimitListeners, getServerVoiceChannelMemberJoinListeners, getServerVoiceChannelMemberLeaveListeners, removeListener, removeServerVoiceChannelAttachableListener
-
Methods inherited from interface org.javacord.api.util.Specializable
as
-
Methods inherited from interface org.javacord.api.entity.channel.VoiceChannel
canConnect, canMuteUsers, canYouConnect, canYouMuteUsers
-
Methods inherited from interface org.javacord.api.listener.channel.VoiceChannelAttachableListenerManager
addVoiceChannelAttachableListener, getVoiceChannelAttachableListeners, removeListener, removeVoiceChannelAttachableListener
-
-
-
-
Method Detail
-
getType
default ChannelType getType()
Description copied from interface:ChannelGets the type of the channel.
-
connect
CompletableFuture<AudioConnection> connect()
Connects to the voice channel and disconnects any existing connections in the server.- Returns:
- The audio connection.
-
getBitrate
int getBitrate()
Gets the bitrate (int bits) of the channel.- Returns:
- The bitrate of the channel.
-
getUserLimit
Optional<Integer> getUserLimit()
Gets the user limit of the channel.- Returns:
- The user limit.
-
getConnectedUserIds
Collection<Long> getConnectedUserIds()
Gets the ids of the users that are connected to this server voice channel.- Returns:
- The ids of the users that are connected to this server voice channel.
-
getConnectedUsers
Collection<User> getConnectedUsers()
Gets the users that are connected to this server voice channel.- Returns:
- The users that are connected to this server voice channel.
-
isConnected
boolean isConnected(long userId)
Checks whether the user with the given id is connected to this channel.- Parameters:
userId- The id of the user to check.- Returns:
- Whether the user with the given id is connected to this channel or not.
-
isConnected
default boolean isConnected(User user)
Checks whether the given user is connected to this channel.- Parameters:
user- The user to check.- Returns:
- Whether the given user is connected to this channel or not.
-
createUpdater
default ServerVoiceChannelUpdater createUpdater()
Creates an updater for this channel.- Specified by:
createUpdaterin interfaceServerChannel- Returns:
- An updater for this channel.
-
updateBitrate
default CompletableFuture<Void> updateBitrate(int bitrate)
Updates the bitrate of the channel.If you want to update several settings at once, it's recommended to use the
ServerVoiceChannelUpdaterfromcreateUpdater()which provides a better performance!- Parameters:
bitrate- The new bitrate of the channel.- Returns:
- A future to check if the update was successful.
-
updateUserLimit
default CompletableFuture<Void> updateUserLimit(int userLimit)
Updates the user limit of the channel.If you want to update several settings at once, it's recommended to use the
ServerVoiceChannelUpdaterfromcreateUpdater()which provides a better performance!- Parameters:
userLimit- The new user limit of the channel.- Returns:
- A future to check if the update was successful.
-
removeUserLimit
default CompletableFuture<Void> removeUserLimit()
Removes the user limit of the channel.If you want to update several settings at once, it's recommended to use the
ServerVoiceChannelUpdaterfromcreateUpdater()which provides a better performance!- Returns:
- A future to check if the update was successful.
-
updateCategory
default CompletableFuture<Void> updateCategory(ChannelCategory category)
Updates the category of the channel.If you want to update several settings at once, it's recommended to use the
ServerVoiceChannelUpdaterfromcreateUpdater()which provides a better performance!- Specified by:
updateCategoryin interfaceCategorizable- Parameters:
category- The new category of the channel.- Returns:
- A future to check if the update was successful.
-
removeCategory
default CompletableFuture<Void> removeCategory()
Removes the category of the channel.If you want to update several settings at once, it's recommended to use the
ServerVoiceChannelUpdaterfromcreateUpdater()which provides a better performance!- Specified by:
removeCategoryin interfaceCategorizable- Returns:
- A future to check if the update was successful.
-
getCurrentCachedInstance
default Optional<ServerVoiceChannel> 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 interfaceServerChannel- Specified by:
getCurrentCachedInstancein interfaceUpdatableFromCache- Specified by:
getCurrentCachedInstancein interfaceVoiceChannel- Returns:
- The current cached instance.
-
getLatestInstance
default CompletableFuture<ServerVoiceChannel> 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 interfaceServerChannel- Specified by:
getLatestInstancein interfaceUpdatable<T extends DiscordEntity>- Specified by:
getLatestInstancein interfaceUpdatableFromCache- Specified by:
getLatestInstancein interfaceVoiceChannel- Returns:
- The current cached instance.
-
-