DefaultVoiceGateway

The default Voice Gateway implementation of Kord, using an HttpClient for the underlying websocket.

Constructors

Link copied to clipboard
constructor(data: DefaultVoiceGatewayData)

Properties

Link copied to clipboard
open override val events: SharedFlow<VoiceEvent>

The incoming VoiceEvents of the Gateway. Users should expect kotlinx.coroutines.flow.Flows to be hot and remain open for the entire lifecycle of the Gateway.

Link copied to clipboard
open override val ping: StateFlow<Duration?>

The Duration between the last Heartbeat and HeartbeatAck.

Link copied to clipboard
open override val scope: CoroutineScope

Functions

Link copied to clipboard
open suspend override fun detach()
Link copied to clipboard
inline fun <T : VoiceEvent> VoiceGateway.on(scope: CoroutineScope = this.scope, crossinline consumer: suspend T.() -> Unit): Job

Convenience method that will invoke the consumer on every event T created by VoiceGateway.events.

Link copied to clipboard
open suspend override fun send(command: Command)

Sends a Command to the gateway, suspending until the message has been sent.

Link copied to clipboard
open suspend override fun start(configuration: VoiceGatewayConfiguration)

Starts a reconnection voice gateway connection with the given configuration. This function will suspend until the lifecycle of the gateway has ended.

Link copied to clipboard
open suspend override fun stop()

Close the Gateway and ends the current session, suspending until the underlying websocket is closed.