Package discord4j.voice
Interface VoiceConnection
-
public interface VoiceConnectionAllows for manipulation of an already-established voice connection.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classVoiceConnection.StateStates of a voice connection.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Mono<Void>disconnect()Disconnects this voice connection, tearing down existing resources associated with it.Flux<VoiceGatewayEvent>events()A sequence ofVoiceGatewayEventreceived from the Voice Gateway session.Mono<Snowflake>getChannelId()Return the current channel ID associated with thisVoiceConnection, if available from caching sources.SnowflakegetGuildId()Return the guild ID tied to thisVoiceConnection.default Mono<Boolean>isConnected()Return whether this voice connection is currently in theVoiceConnection.State.CONNECTEDstate.default Mono<VoiceConnection.State>onConnectOrDisconnect()Return aMonothat completes when this connection reaches aVoiceConnection.State.CONNECTEDorVoiceConnection.State.DISCONNECTEDstate.Mono<Void>reconnect()Instruct a reconnect procedure on this voice connection.default Mono<Void>reconnect(Function<ContextView,Throwable> errorCause)Instruct a reconnect procedure on this voice connection, using a customThrowableas cause.Flux<VoiceConnection.State>stateEvents()Return a sequence of theVoiceConnection.Statetransitions this voice connection receives.
-
-
-
Method Detail
-
events
Flux<VoiceGatewayEvent> events()
A sequence ofVoiceGatewayEventreceived from the Voice Gateway session.- Returns:
- a
FluxofVoiceGatewayEvent
-
isConnected
default Mono<Boolean> isConnected()
Return whether this voice connection is currently in theVoiceConnection.State.CONNECTEDstate.- Returns:
- a
Monothat, upon subscription, returns whether the current state is CONNECTED
-
onConnectOrDisconnect
default Mono<VoiceConnection.State> onConnectOrDisconnect()
Return aMonothat completes when this connection reaches aVoiceConnection.State.CONNECTEDorVoiceConnection.State.DISCONNECTEDstate. Only state transitions made after subscription are taken into account.- Returns:
- a
Monothat signals one of the CONNECTED or DISCONNECTED states
-
stateEvents
Flux<VoiceConnection.State> stateEvents()
Return a sequence of theVoiceConnection.Statetransitions this voice connection receives.- Returns:
- a
FluxofVoiceConnection.Stateelements
-
disconnect
Mono<Void> disconnect()
Disconnects this voice connection, tearing down existing resources associated with it.- Returns:
- a
Monothat, upon subscription, disconnects this voice connection. If an error occurrs, it is emitted through theMono
-
getGuildId
Snowflake getGuildId()
Return the guild ID tied to thisVoiceConnection. UnlikegetChannelId(), this method returns synchronously as voice connections are always bound to a single guild.- Returns:
- the guild ID of this connection
-
getChannelId
Mono<Snowflake> getChannelId()
Return the current channel ID associated with thisVoiceConnection, if available from caching sources. May return empty if no information is available.- Returns:
- a
Monothat, upon subscription, returns the channel ID this connection is currently pointing to, if available
-
reconnect
Mono<Void> reconnect()
Instruct a reconnect procedure on this voice connection.- Returns:
- a
Monothat, upon subscription, attempts to reconnect to the voice gateway, maintaining the same parameters currently associated to this instance
-
reconnect
default Mono<Void> reconnect(Function<ContextView,Throwable> errorCause)
Instruct a reconnect procedure on this voice connection, using a customThrowableas cause. Implementations can use this to differentiate between a RESUME action (that does not tear down UDP resources) or a full RECONNECT.- Returns:
- a
Monothat, upon subscription, attempts to reconnect to the voice gateway, maintaining the same parameters currently associated to this instance
-
-