Interface ServerVoiceChannel
-
- All Superinterfaces:
Categorizable
,Channel
,ChannelAttachableListenerManager
,ChannelSpecialization
,java.lang.Comparable<RegularServerChannel>
,Deletable
,DiscordEntity
,java.util.Formattable
,Nameable
,RegularServerChannel
,ServerChannel
,ServerChannelAttachableListenerManager
,ServerVoiceChannelAttachableListenerManager
,Specializable<ChannelSpecialization>
,Updatable
,UpdatableFromCache
,VoiceChannel
,VoiceChannelAttachableListenerManager
- All Known Subinterfaces:
ServerStageVoiceChannel
public interface ServerVoiceChannel extends RegularServerChannel, 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 default boolean
canConnect(User user)
Checks if the given user can connect to the voice channel.default boolean
canDeafenUsers(User user)
Checks if the given user can deafen users in this voice channel.default boolean
canMoveUsers(User user)
Checks if the given user can move users in this voice channel.default boolean
canMuteUsers(User user)
Checks if the given user can mute users in this voice channel.default boolean
canSpeak(User user)
Checks if the given user can speak in this voice channel.default boolean
canUseVideo(User user)
Checks if the given user can use video in this voice channel.default boolean
canUseVoiceActivation(User user)
Checks if the given user can use voice activation in this voice channel.default boolean
canYouConnect()
Checks if the user of the connected account can connect to the voice channel.default boolean
canYouDeafenUsers()
Checks if the user of the connected account can deafen users in this voice channel.default boolean
canYouMoveUsers()
Checks if the user of the connected account can move users in this voice channel.default boolean
canYouMuteUsers()
Checks if the user of the connected account can mute users in this voice channel.default boolean
canYouSpeak()
Checks if the user of the connected account can speak in this voice channel.default boolean
canYouUseVideo()
Checks if the user of the connected account can use video in this voice channel.default boolean
canYouUseVoiceActivation()
Checks if the user of the connected account can use voice activation in this voice channel.default java.util.concurrent.CompletableFuture<AudioConnection>
connect()
Connects to the voice channel self-deafened and disconnects any existing connections in the server.java.util.concurrent.CompletableFuture<AudioConnection>
connect(boolean muted, boolean deafened)
Connects to the voice channel and disconnects any existing connections in the server.default ServerVoiceChannelUpdater
createUpdater()
Creates an updater for this channel.default java.util.concurrent.CompletableFuture<java.lang.Void>
disconnect()
Disconnects from the voice channel if connected.int
getBitrate()
Gets the bitrate (int bits) of the channel.java.util.Set<java.lang.Long>
getConnectedUserIds()
Gets the ids of the users that are connected to this server voice channel.java.util.Set<User>
getConnectedUsers()
Gets the users that are connected to this server voice channel.default java.util.Optional<? extends ServerVoiceChannel>
getCurrentCachedInstance()
Gets an updated instance of this entity from the cache.default java.util.concurrent.CompletableFuture<? extends ServerVoiceChannel>
getLatestInstance()
Gets an updated instance of this entity from the cache or from Discord directly.java.util.Optional<java.lang.Integer>
getUserLimit()
Gets the user limit of the channel.boolean
isConnected(long userId)
Checks whether the user with the given id is connected to this channel.default boolean
isConnected(User user)
Checks whether the given user is connected to this channel.boolean
isNsfw()
Checks if the channel is "not safe for work".default boolean
isPrioritySpeaker(User user)
Checks if the given user is a priority speaker in this voice channel.default java.util.concurrent.CompletableFuture<java.lang.Void>
removeCategory()
Removes the category of the channel.default java.util.concurrent.CompletableFuture<java.lang.Void>
removeUserLimit()
Removes the user limit of the channel.default java.util.concurrent.CompletableFuture<java.lang.Void>
updateBitrate(int bitrate)
Updates the bitrate of the channel.default java.util.concurrent.CompletableFuture<java.lang.Void>
updateCategory(ChannelCategory category)
Updates the category of the channel.default java.util.concurrent.CompletableFuture<java.lang.Void>
updateNsfwFlag(boolean nsfw)
Updates the nsfw flag of the channel.default java.util.concurrent.CompletableFuture<java.lang.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, 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.entity.channel.RegularServerChannel
canCreateInstantInvite, canYouCreateInstantInvite, compareTo, 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.listener.channel.server.voice.ServerVoiceChannelAttachableListenerManager
addServerVoiceChannelAttachableListener, addServerVoiceChannelChangeBitrateListener, addServerVoiceChannelChangeNsfwListener, addServerVoiceChannelChangeUserLimitListener, addServerVoiceChannelMemberJoinListener, addServerVoiceChannelMemberLeaveListener, getServerVoiceChannelAttachableListeners, getServerVoiceChannelChangeBitrateListeners, getServerVoiceChannelChangeNsfwListeners, getServerVoiceChannelChangeUserLimitListeners, getServerVoiceChannelMemberJoinListeners, getServerVoiceChannelMemberLeaveListeners, removeListener, removeServerVoiceChannelAttachableListener
-
Methods inherited from interface org.javacord.api.util.Specializable
as
-
Methods inherited from interface org.javacord.api.listener.channel.VoiceChannelAttachableListenerManager
addVoiceChannelAttachableListener, getVoiceChannelAttachableListeners, removeListener, removeVoiceChannelAttachableListener
-
-
-
-
Method Detail
-
connect
default java.util.concurrent.CompletableFuture<AudioConnection> connect()
Connects to the voice channel self-deafened and disconnects any existing connections in the server.- Returns:
- The audio connection.
-
connect
java.util.concurrent.CompletableFuture<AudioConnection> connect(boolean muted, boolean deafened)
Connects to the voice channel and disconnects any existing connections in the server.- Parameters:
muted
- Whether to connect self-muted.deafened
- Whether to connect self-deafened.- Returns:
- The audio connection.
-
disconnect
default java.util.concurrent.CompletableFuture<java.lang.Void> disconnect()
Disconnects from the voice channel if connected.- Returns:
- A CompletableFuture which completes when the connection has been disconnected.
-
isNsfw
boolean isNsfw()
Checks if the channel is "not safe for work".- Returns:
- Whether the channel is "not safe for work" or not.
-
getBitrate
int getBitrate()
Gets the bitrate (int bits) of the channel.- Returns:
- The bitrate of the channel.
-
getUserLimit
java.util.Optional<java.lang.Integer> getUserLimit()
Gets the user limit of the channel.- Returns:
- The user limit.
-
getConnectedUserIds
java.util.Set<java.lang.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
java.util.Set<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.
-
isPrioritySpeaker
default boolean isPrioritySpeaker(User user)
Checks if the given user is a priority speaker in this voice channel.- Parameters:
user
- The user to check.- Returns:
- Whether the given user is a priority speaker or not.
-
canConnect
default boolean canConnect(User user)
Checks if the given user can connect to the voice channel.- Parameters:
user
- The user to check.- Returns:
- Whether the given user can connect or not.
-
canYouConnect
default boolean canYouConnect()
Checks if the user of the connected account can connect to the voice channel.- Returns:
- Whether the user of the connected account can connect or not.
-
canMuteUsers
default boolean canMuteUsers(User user)
Checks if the given user can mute users in this voice channel.- Parameters:
user
- The user to check.- Returns:
- Whether the given user can mute users or not.
-
canYouMuteUsers
default boolean canYouMuteUsers()
Checks if the user of the connected account can mute users in this voice channel.- Returns:
- Whether the user of the connected account can mute users or not.
-
canSpeak
default boolean canSpeak(User user)
Checks if the given user can speak in this voice channel.- Parameters:
user
- The user to check.- Returns:
- Whether the given user can speak or not.
-
canYouSpeak
default boolean canYouSpeak()
Checks if the user of the connected account can speak in this voice channel.- Returns:
- Whether the user of the connected account can speak or not.
-
canUseVideo
default boolean canUseVideo(User user)
Checks if the given user can use video in this voice channel.- Parameters:
user
- The user to check.- Returns:
- Whether the given user can use video or not.
-
canYouUseVideo
default boolean canYouUseVideo()
Checks if the user of the connected account can use video in this voice channel.- Returns:
- Whether the user of the connected account can use video or not.
-
canMoveUsers
default boolean canMoveUsers(User user)
Checks if the given user can move users in this voice channel.- Parameters:
user
- The user to check.- Returns:
- Whether the given user can move users or not.
-
canYouMoveUsers
default boolean canYouMoveUsers()
Checks if the user of the connected account can move users in this voice channel.- Returns:
- Whether the user of the connected account can move users or not.
-
canUseVoiceActivation
default boolean canUseVoiceActivation(User user)
Checks if the given user can use voice activation in this voice channel.- Parameters:
user
- The user to check.- Returns:
- Whether the given user can use voice activation or not.
-
canYouUseVoiceActivation
default boolean canYouUseVoiceActivation()
Checks if the user of the connected account can use voice activation in this voice channel.- Returns:
- Whether the user of the connected account can use voice activation or not.
-
canDeafenUsers
default boolean canDeafenUsers(User user)
Checks if the given user can deafen users in this voice channel.- Parameters:
user
- The user to check.- Returns:
- Whether the given user can deafen users or not.
-
canYouDeafenUsers
default boolean canYouDeafenUsers()
Checks if the user of the connected account can deafen users in this voice channel.- Returns:
- Whether the user of the connected account can deafen users or not.
-
createUpdater
default ServerVoiceChannelUpdater createUpdater()
Creates an updater for this channel.- Specified by:
createUpdater
in interfaceRegularServerChannel
- Specified by:
createUpdater
in interfaceServerChannel
- Returns:
- An updater for this channel.
-
updateBitrate
default java.util.concurrent.CompletableFuture<java.lang.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
ServerVoiceChannelUpdater
fromcreateUpdater()
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 java.util.concurrent.CompletableFuture<java.lang.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
ServerVoiceChannelUpdater
fromcreateUpdater()
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 java.util.concurrent.CompletableFuture<java.lang.Void> removeUserLimit()
Removes the user limit of the channel.If you want to update several settings at once, it's recommended to use the
ServerVoiceChannelUpdater
fromcreateUpdater()
which provides a better performance!- Returns:
- A future to check if the update was successful.
-
updateCategory
default java.util.concurrent.CompletableFuture<java.lang.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
ServerVoiceChannelUpdater
fromcreateUpdater()
which provides a better performance!- Specified by:
updateCategory
in interfaceCategorizable
- Parameters:
category
- The new category of the channel.- Returns:
- A future to check if the update was successful.
-
removeCategory
default java.util.concurrent.CompletableFuture<java.lang.Void> removeCategory()
Removes the category of the channel.If you want to update several settings at once, it's recommended to use the
ServerVoiceChannelUpdater
fromcreateUpdater()
which provides a better performance!- Specified by:
removeCategory
in interfaceCategorizable
- Returns:
- A future to check if the update was successful.
-
getCurrentCachedInstance
default java.util.Optional<? extends ServerVoiceChannel> getCurrentCachedInstance()
Description copied from interface:UpdatableFromCache
Gets 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
Optional
if the entity is not cached any longer, for example because it was deleted or the message was thrown out of the cache.- Specified by:
getCurrentCachedInstance
in interfaceChannel
- Specified by:
getCurrentCachedInstance
in interfaceRegularServerChannel
- Specified by:
getCurrentCachedInstance
in interfaceServerChannel
- Specified by:
getCurrentCachedInstance
in interfaceUpdatableFromCache
- Specified by:
getCurrentCachedInstance
in interfaceVoiceChannel
- Returns:
- The current cached instance.
-
getLatestInstance
default java.util.concurrent.CompletableFuture<? extends ServerVoiceChannel> getLatestInstance()
Description copied from interface:Updatable
Gets 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
CompletableFuture
completes exceptionally with aNoSuchElementException
. If a request to Discord is made, the according remote call exception will be used to complete theCompletableFuture
exceptionally.- Specified by:
getLatestInstance
in interfaceChannel
- Specified by:
getLatestInstance
in interfaceRegularServerChannel
- Specified by:
getLatestInstance
in interfaceServerChannel
- Specified by:
getLatestInstance
in interfaceUpdatable
- Specified by:
getLatestInstance
in interfaceUpdatableFromCache
- Specified by:
getLatestInstance
in interfaceVoiceChannel
- Returns:
- The current cached instance.
-
updateNsfwFlag
default java.util.concurrent.CompletableFuture<java.lang.Void> updateNsfwFlag(boolean nsfw)
Updates the nsfw flag of the channel.If you want to update several settings at once, it's recommended to use the
ServerVoiceChannelUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
nsfw
- The new nsfw flag of the channel.- Returns:
- A future to check if the update was successful.
-
-