Class VoiceState

java.lang.Object
discord4j.core.object.VoiceState
All Implemented Interfaces:
DiscordObject

public final class VoiceState extends Object implements DiscordObject
A Discord voice state.
See Also:
  • Constructor Details

    • VoiceState

      public VoiceState(GatewayDiscordClient gateway, discord4j.discordjson.json.VoiceStateData data)
      Constructs a VoiceState with an associated GatewayDiscordClient and Discord data.
      Parameters:
      gateway - The GatewayDiscordClient associated to this object, must be non-null.
      data - The raw data as represented by Discord, must be non-null.
  • Method Details

    • getClient

      public GatewayDiscordClient getClient()
      Description copied from interface: DiscordObject
      Returns the GatewayDiscordClient that created this object. Methods in it are exclusively based on the entity cache or Store in use. Refer to calling getClient().rest() to access a DiscordClient that is capable of requesting entities directly from the REST API.
      Specified by:
      getClient in interface DiscordObject
      Returns:
      The GatewayDiscordClient associated to this object.
    • getData

      public discord4j.discordjson.json.VoiceStateData getData()
      Gets the data of the voice state.
      Returns:
      The data of the voice state.
    • getGuildId

      public Snowflake getGuildId()
      Gets the guild ID this voice state is for.
      Returns:
      The guild ID this voice state is for.
    • getGuild

      public Mono<Guild> getGuild()
      Requests to retrieve the guild this voice state is for.
      Returns:
      A Mono where, upon successful completion, emits the Guild this voice state is for. If an error is received, it is emitted through the Mono.
    • getGuild

      public Mono<Guild> getGuild(EntityRetrievalStrategy retrievalStrategy)
      Requests to retrieve the guild this voice state is for, using the given retrieval strategy.
      Parameters:
      retrievalStrategy - the strategy to use to get the guild
      Returns:
      A Mono where, upon successful completion, emits the Guild this voice state is for. If an error is received, it is emitted through the Mono.
    • getChannelId

      public Optional<Snowflake> getChannelId()
      Gets the channel ID this user is connected to, if present.
      Returns:
      The channel ID this user is connected to, if present.
    • getChannel

      public Mono<AudioChannel> getChannel()
      Requests to retrieve the audio channel this user is connected to, if present.
      Returns:
      A Mono where, upon successful completion, emits the AudioChannel this user is connected to, if present. If an error is received, it is emitted through the Mono.
    • getChannel

      public Mono<AudioChannel> getChannel(EntityRetrievalStrategy retrievalStrategy)
      Requests to retrieve the audio channel this user is connected to, if present, using the given retrieval strategy.
      Parameters:
      retrievalStrategy - the strategy to use to get the channel
      Returns:
      A Mono where, upon successful completion, emits the AudioChannel this user is connected to, if present. If an error is received, it is emitted through the Mono.
    • getUserId

      public Snowflake getUserId()
      Gets the user ID this voice state is for.
      Returns:
      The user ID this voice state is for.
    • getUser

      public Mono<User> getUser()
      Requests to retrieve the user this voice state is for.
      Returns:
      A Mono where, upon successful completion, emits the User this voice state is for. If an error is received, it is emitted through the Mono.
    • getUser

      public Mono<User> getUser(EntityRetrievalStrategy retrievalStrategy)
      Requests to retrieve the user this voice state is for, using the given retrieval strategy.
      Parameters:
      retrievalStrategy - the strategy to use to get the user
      Returns:
      A Mono where, upon successful completion, emits the User this voice state is for. If an error is received, it is emitted through the Mono.
    • getMember

      public Mono<Member> getMember()
      Requests to retrieve the member this voice state is for.
      Returns:
      A Mono where, upon successful completion, emits the Member this voice state is for. If an error is received, it is emitted through the Mono.
    • getMember

      public Mono<Member> getMember(EntityRetrievalStrategy retrievalStrategy)
      Requests to retrieve the member this voice state is for, using the given retrieval strategy.
      Parameters:
      retrievalStrategy - the strategy to use to get the member
      Returns:
      A Mono where, upon successful completion, emits the Member this voice state is for. If an error is received, it is emitted through the Mono.
    • getSessionId

      public String getSessionId()
      Gets the session ID for this voice state.
      Returns:
      The session ID for this voice state.
    • isDeaf

      public boolean isDeaf()
      Gets whether this user is deafened by the server.
      Returns:
      true if the user is deafened by the server, false otherwise.
    • isMuted

      public boolean isMuted()
      Gets whether this user is muted by the server.
      Returns:
      true if the user is deafened by the server, false otherwise.
    • isSelfDeaf

      public boolean isSelfDeaf()
      Gets whether this user is locally deafened.
      Returns:
      true if this user is locally deafened, false otherwise.
    • isSelfMuted

      public boolean isSelfMuted()
      Gets whether this user is locally muted.
      Returns:
      true if this user is locally muted, false otherwise.
    • isSelfStreaming

      public boolean isSelfStreaming()
      Gets whether this user is streaming using "Go Live".
      Returns:
      true if this user is streaming using "Go Live", false otherwise.
    • isSelfVideoEnabled

      public boolean isSelfVideoEnabled()
      Gets whether this user's camera is enabled.
      Returns:
      true if this user's camera is enabled, false otherwise.
    • isSuppressed

      public boolean isSuppressed()
      Gets whether this user is muted by the current user.
      Returns:
      true if this user is muted by the current user, false otherwise.
    • getRequestedToSpeakAt

      public Optional<Instant> getRequestedToSpeakAt()
      Gets the time at which the user requested to speak, if present.
      Returns:
      The time at which the user requested to speak, if present.
    • toString

      public String toString()
      Overrides:
      toString in class Object