Package org.javacord.api.entity.channel
Interface VoiceChannel
-
- All Superinterfaces:
Channel,ChannelAttachableListenerManager,ChannelSpecialization,DiscordEntity,Specializable<T>,Updatable<T>,UpdatableFromCache,VoiceChannelAttachableListenerManager
- All Known Subinterfaces:
GroupChannel,PrivateChannel,ServerStageVoiceChannel,ServerVoiceChannel
public interface VoiceChannel extends Channel, VoiceChannelAttachableListenerManager
This class represents a voice channel.
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default booleancanConnect(User user)Checks if the given user can connect to the voice channel.default booleancanMuteUsers(User user)Checks if the given user can mute other users in this voice channel.default booleancanYouConnect()Checks if the user of the connected account can connect to the voice channel.default booleancanYouMuteUsers()Checks if the user of the connected account can mute other users in this voice channel.default Optional<? extends VoiceChannel>getCurrentCachedInstance()Gets an updated instance of this entity from the cache.default CompletableFuture<? extends VoiceChannel>getLatestInstance()Gets an updated instance of this entity from the cache or from Discord directly.-
Methods inherited from interface org.javacord.api.entity.channel.Channel
asCategorizable, asChannelCategory, asGroupChannel, asPrivateChannel, asServerChannel, asServerStageVoiceChannel, asServerTextChannel, 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.DiscordEntity
getApi, getCreationTimestamp, getCreationTimestamp, getId, getIdAsString
-
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
-
canConnect
default boolean canConnect(User user)
Checks if the given user can connect to the voice channel. In private chats (private channel or group channel) this always returnstrueif the user is part of the chat.- 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. In private chats (private channel or group channel) this always returnstrueif the user is part of the chat.- 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 other users in this voice channel. In private chats (private channel or group channel) this always returnsfalse.- Parameters:
user- The user to check.- Returns:
- Whether the given user can mute other users or not.
-
canYouMuteUsers
default boolean canYouMuteUsers()
Checks if the user of the connected account can mute other users in this voice channel. In private chats (private channel or group channel) this always returnsfalse.- Returns:
- Whether the user of the connected account can mute other users or not.
-
getCurrentCachedInstance
default Optional<? extends VoiceChannel> 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 CompletableFuture<? extends VoiceChannel> 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<T extends DiscordEntity>- Specified by:
getLatestInstancein interfaceUpdatableFromCache- Returns:
- The current cached instance.
-
-