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 aVoiceState
with an associatedGatewayDiscordClient
and 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.GatewayDiscordClient
getClient()
Returns theGatewayDiscordClient
that created this object.discord4j.discordjson.json.VoiceStateData
getData()
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.Snowflake
getGuildId()
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.String
getSessionId()
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.Snowflake
getUserId()
Gets the user ID this voice state is for.boolean
isDeaf()
Gets whether this user is deafened by the server.boolean
isMuted()
Gets whether this user is muted by the server.boolean
isSelfDeaf()
Gets whether this user is locally deafened.boolean
isSelfMuted()
Gets whether this user is locally muted.boolean
isSelfStreaming()
Gets whether this user is streaming using "Go Live".boolean
isSelfVideoEnabled()
Gets whether this user's camera is enabled.boolean
isSuppressed()
Gets whether this user is muted by the current user.String
toString()
-
-
-
Constructor Detail
-
VoiceState
public VoiceState(GatewayDiscordClient gateway, discord4j.discordjson.json.VoiceStateData data)
Constructs aVoiceState
with an associatedGatewayDiscordClient
and Discord data.- Parameters:
gateway
- TheGatewayDiscordClient
associated 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:DiscordObject
Returns theGatewayDiscordClient
that created this object. Methods in it are exclusively based on the entity cache orStore
in use. Refer to callinggetClient().rest()
to access aDiscordClient
that is capable of requesting entities directly from the REST API.- Specified by:
getClient
in interfaceDiscordObject
- 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(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
Mono
where, upon successful completion, emits theVoiceChannel
this 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
Mono
where, upon successful completion, emits theVoiceChannel
this 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:
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.
-
-