Package discord4j.core.object
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:
- Voice Resource
-
-
Constructor Summary
Constructors Constructor Description VoiceState(GatewayDiscordClient gateway, discord4j.discordjson.json.VoiceStateData data)Constructs aVoiceStatewith an associatedGatewayDiscordClientand Discord data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Mono<VoiceChannel>getChannel()Requests to retrieve the channel this user is connected to, if present.Mono<VoiceChannel>getChannel(EntityRetrievalStrategy retrievalStrategy)Requests to retrieve the channel this user is connected to, if present, using the given retrieval strategy.Optional<Snowflake>getChannelId()Gets the channel ID this user is connected to, if present.GatewayDiscordClientgetClient()Returns theGatewayDiscordClientthat created this object.discord4j.discordjson.json.VoiceStateDatagetData()Gets the data of the voice state.Mono<Guild>getGuild()Requests to retrieve the guild this voice state is for.Mono<Guild>getGuild(EntityRetrievalStrategy retrievalStrategy)Requests to retrieve the guild this voice state is for, using the given retrieval strategy.SnowflakegetGuildId()Gets the guild ID this voice state is for.Mono<Member>getMember()Requests to retrieve the member this voice state is for.Mono<Member>getMember(EntityRetrievalStrategy retrievalStrategy)Requests to retrieve the member this voice state is for, using the given retrieval strategy.Optional<Instant>getRequestedToSpeakAt()Gets the time at which the user requested to speak, if present.StringgetSessionId()Gets the session ID for this voice state.Mono<User>getUser()Requests to retrieve the user this voice state is for.Mono<User>getUser(EntityRetrievalStrategy retrievalStrategy)Requests to retrieve the user this voice state is for, using the given retrieval strategy.SnowflakegetUserId()Gets the user ID this voice state is for.booleanisDeaf()Gets whether this user is deafened by the server.booleanisMuted()Gets whether this user is muted by the server.booleanisSelfDeaf()Gets whether this user is locally deafened.booleanisSelfMuted()Gets whether this user is locally muted.booleanisSelfStreaming()Gets whether this user is streaming using "Go Live".booleanisSelfVideoEnabled()Gets whether this user's camera is enabled.booleanisSuppressed()Gets whether this user is muted by the current user.StringtoString()
-
-
-
Constructor Detail
-
VoiceState
public VoiceState(GatewayDiscordClient gateway, discord4j.discordjson.json.VoiceStateData data)
Constructs aVoiceStatewith an associatedGatewayDiscordClientand Discord data.- Parameters:
gateway- TheGatewayDiscordClientassociated to this object, must be non-null.data- The raw data as represented by Discord, must be non-null.
-
-
Method Detail
-
getClient
public GatewayDiscordClient getClient()
Description copied from interface:DiscordObjectReturns theGatewayDiscordClientthat created this object. Methods in it are exclusively based on the entity cache orStorein use. Refer to callinggetClient().rest()to access aDiscordClientthat is capable of requesting entities directly from the REST API.- Specified by:
getClientin interfaceDiscordObject- Returns:
- The
GatewayDiscordClientassociated 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(EntityRetrievalStrategy retrievalStrategy)
Requests to retrieve the guild this voice state is for, using the given retrieval strategy.
-
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<VoiceChannel> getChannel()
Requests to retrieve the channel this user is connected to, if present.- Returns:
- A
Monowhere, upon successful completion, emits theVoiceChannelthis user is connected to, if present. If an error is received, it is emitted through theMono.
-
getChannel
public Mono<VoiceChannel> getChannel(EntityRetrievalStrategy retrievalStrategy)
Requests to retrieve the 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
Monowhere, upon successful completion, emits theVoiceChannelthis user is connected to, if present. If an error is received, it is emitted through theMono.
-
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(EntityRetrievalStrategy retrievalStrategy)
Requests to retrieve the user this voice state is for, using the given retrieval strategy.
-
getMember
public Mono<Member> getMember(EntityRetrievalStrategy retrievalStrategy)
Requests to retrieve the member this voice state is for, using the given retrieval strategy.
-
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:
trueif the user is deafened by the server,falseotherwise.
-
isMuted
public boolean isMuted()
Gets whether this user is muted by the server.- Returns:
trueif the user is deafened by the server,falseotherwise.
-
isSelfDeaf
public boolean isSelfDeaf()
Gets whether this user is locally deafened.- Returns:
trueif this user is locally deafened,falseotherwise.
-
isSelfMuted
public boolean isSelfMuted()
Gets whether this user is locally muted.- Returns:
trueif this user is locally muted,falseotherwise.
-
isSelfStreaming
public boolean isSelfStreaming()
Gets whether this user is streaming using "Go Live".- Returns:
trueif this user is streaming using "Go Live",falseotherwise.
-
isSelfVideoEnabled
public boolean isSelfVideoEnabled()
Gets whether this user's camera is enabled.- Returns:
trueif this user's camera is enabled,falseotherwise.
-
isSuppressed
public boolean isSuppressed()
Gets whether this user is muted by the current user.- Returns:
trueif this user is muted by the current user,falseotherwise.
-
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.
-
-