Interface VoiceConnection


  • public interface VoiceConnection
    Allows for manipulation of an already-established voice connection.
    • Method Detail

      • isConnected

        default Mono<Boolean> isConnected()
        Return whether this voice connection is currently in the VoiceConnection.State.CONNECTED state.
        Returns:
        a Mono that, upon subscription, returns whether the current state is CONNECTED
      • disconnect

        Mono<Void> disconnect()
        Disconnects this voice connection, tearing down existing resources associated with it.
        Returns:
        a Mono that, upon subscription, disconnects this voice connection. If an error occurrs, it is emitted through the Mono
      • getGuildId

        Snowflake getGuildId()
        Return the guild ID tied to this VoiceConnection. Unlike getChannelId(), 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 this VoiceConnection, if available from caching sources. May return empty if no information is available.
        Returns:
        a Mono that, 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 Mono that, 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 custom Throwable as cause. Implementations can use this to differentiate between a RESUME action (that does not tear down UDP resources) or a full RECONNECT.
        Returns:
        a Mono that, upon subscription, attempts to reconnect to the voice gateway, maintaining the same parameters currently associated to this instance