DefaultGateway

The default Gateway implementation of Kord, using an HttpClient for the underlying webSocket

Constructors

Link copied to clipboard
constructor(data: DefaultGatewayData)

Types

Link copied to clipboard
object Companion

Properties

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

The incoming events of the Gateway.

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

The duration between the last Heartbeat and HeartbeatACK.

Functions

Link copied to clipboard
open suspend override fun detach()

Close gateway and releases resources.

Link copied to clipboard
inline suspend fun Gateway.editPresence(builder: PresenceBuilder.() -> Unit)
Link copied to clipboard
inline fun <T : Event> Gateway.on(scope: CoroutineScope = this, crossinline consumer: suspend T.() -> Unit): Job

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

Link copied to clipboard

Executes the request on this gateway, returning a flow of GuildMembersChunk responses.

fun Gateway.requestGuildMembers(guildId: Snowflake, builder: RequestGuildMembersBuilder.() -> Unit = { requestAllMembers() }): Flow<GuildMembersChunk>

Executes a RequestGuildMembers command configured by the builder for the given guildId on this gateway, returning a flow of GuildMembersChunk responses.

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: GatewayConfiguration)

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

Link copied to clipboard
inline suspend fun Gateway.start(token: String, config: GatewayConfigurationBuilder.() -> Unit = {})

Starts a reconnecting gateway connection with the given parameters. This function will suspend until the lifecycle of the gateway has ended.

Link copied to clipboard
open suspend override fun stop()

Closes the Gateway and ends the current session, suspending until the underlying webSocket is closed.