Package-level declarations

Types

Link copied to clipboard
data class AutoModerationActionExecution(val actionExecution: DiscordAutoModerationActionExecution, val sequence: Int?) : DispatchEvent
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
data class ChannelCreate(val channel: DiscordChannel, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class ChannelDelete(val channel: DiscordChannel, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class ChannelPinsUpdate(val pins: DiscordPinsUpdateData, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class ChannelUpdate(val channel: DiscordChannel, val sequence: Int?) : DispatchEvent
Link copied to clipboard
sealed class Close : Event
Link copied to clipboard
sealed class Command
Link copied to clipboard

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

Link copied to clipboard
Link copied to clipboard
data class DefaultGatewayData(val url: String, val client: HttpClient, val reconnectRetry: Retry, val sendRateLimiter: RateLimiter, val identifyRateLimiter: IdentifyRateLimiter, val dispatcher: CoroutineDispatcher, val eventFlow: MutableSharedFlow<Event>)
Link copied to clipboard
data class DiscordAutoModerationActionExecution(val guildId: Snowflake, val action: DiscordAutoModerationAction, val ruleId: Snowflake, val ruleTriggerType: AutoModerationRuleTriggerType, val userId: Snowflake, val channelId: OptionalSnowflake = OptionalSnowflake.Missing, val messageId: OptionalSnowflake = OptionalSnowflake.Missing, val alertSystemMessageId: OptionalSnowflake = OptionalSnowflake.Missing, val content: String, val matchedKeyword: String?, val matchedContent: String?)
Link copied to clipboard
data class DiscordCreatedInvite(val channelId: Snowflake, val code: String, val createdAt: Instant, val guildId: OptionalSnowflake = OptionalSnowflake.Missing, val inviter: Optional<DiscordUser> = Optional.Missing(), val maxAge: DurationInSeconds, val maxUses: Int, val targetType: Optional<InviteTargetType> = Optional.Missing(), val targetUser: Optional<DiscordUser> = Optional.Missing(), val targetApplication: Optional<DiscordPartialApplication> = Optional.Missing(), val temporary: Boolean, val uses: Int)
Link copied to clipboard
data class DiscordDeletedInvite(val channelId: Snowflake, val guildId: OptionalSnowflake = OptionalSnowflake.Missing, val code: String)
Link copied to clipboard
data class DiscordPresence(val status: PresenceStatus, val afk: Boolean, val since: InstantInEpochMilliseconds? = null, val game: DiscordBotActivity? = null)
Link copied to clipboard
data class DiscordRemovedEmoji(val channelId: Snowflake, val guildId: Snowflake, val messageId: Snowflake, val emoji: DiscordRemovedReactionEmoji)
Link copied to clipboard
data class DiscordRemovedReactionEmoji(val id: Snowflake?, val name: String?)
Link copied to clipboard
data class DiscordThreadListSync(val guildId: Snowflake, val channelIds: Optional<List<Snowflake>> = Optional.Missing(), val threads: List<DiscordChannel>, val members: List<DiscordThreadMember>)
Link copied to clipboard
data class DiscordThreadMembersUpdate(val id: Snowflake, val guildId: Snowflake, val memberCount: Int, val addedMembers: Optional<List<DiscordThreadMember>> = Optional.Missing(), val removedMemberIds: Optional<List<Snowflake>> = Optional.Missing())
Link copied to clipboard
sealed class DispatchEvent : Event
Link copied to clipboard
data class EntitlementCreate(val entitlement: DiscordEntitlement, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class EntitlementDelete(val entitlement: DiscordEntitlement, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class EntitlementUpdate(val entitlement: DiscordEntitlement, val sequence: Int?) : DispatchEvent
Link copied to clipboard
sealed class Event
Link copied to clipboard

An implementation of the Discord Gateway and its lifecycle.

Link copied to clipboard

Enum representation of Discord's Gateway close event codes.

Link copied to clipboard
data class GatewayConfiguration(val token: String, val name: String, val shard: DiscordShard, val presence: Optional<DiscordPresence> = Optional.Missing(), val threshold: Int, val intents: Intents)
Link copied to clipboard
class GatewayConfigurationBuilder(val token: String, var name: String = "Kord", var shard: DiscordShard = DiscordShard(0, 1), var presence: DiscordPresence? = null, var threshold: Int = 250, var intents: Intents = Intents.NON_PRIVILEGED)
Link copied to clipboard
data class GuildAuditLogEntryCreate(val entry: DiscordAuditLogEntry, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class GuildBanAdd(val ban: DiscordGuildBan, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class GuildBanRemove(val ban: DiscordGuildBan, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class GuildCreate(val guild: DiscordGuild, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class GuildDelete(val guild: DiscordUnavailableGuild, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class GuildEmojisUpdate(val emoji: DiscordUpdatedEmojis, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class GuildIntegrationsUpdate(val integrations: DiscordGuildIntegrations, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class GuildMemberAdd(val member: DiscordAddedGuildMember, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class GuildMemberRemove(val member: DiscordRemovedGuildMember, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class GuildMembersChunk(val data: GuildMembersChunkData, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class GuildMembersChunkData(val guildId: Snowflake, val members: List<DiscordGuildMember>, val chunkIndex: Int, val chunkCount: Int, val notFound: Optional<Set<Snowflake>> = Optional.Missing(), val presences: Optional<List<DiscordPresenceUpdate>> = Optional.Missing(), val nonce: Optional<String> = Optional.Missing())
Link copied to clipboard
data class GuildMemberUpdate(val member: DiscordUpdatedGuildMember, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class GuildRoleCreate(val role: DiscordGuildRole, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class GuildRoleDelete(val role: DiscordDeletedGuildRole, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class GuildRoleUpdate(val role: DiscordGuildRole, val sequence: Int?) : DispatchEvent
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
data class GuildScheduledEventUserMetadata(val guildScheduledEventId: Snowflake, val userId: Snowflake, val guildId: Snowflake)
Link copied to clipboard
Link copied to clipboard
data class GuildUpdate(val guild: DiscordGuild, val sequence: Int?) : DispatchEvent
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
data class Hello(val heartbeatInterval: Int) : Event
Link copied to clipboard
data class Identify(val token: String, val properties: IdentifyProperties, val compress: OptionalBoolean = OptionalBoolean.Missing, val largeThreshold: OptionalInt = OptionalInt.Missing, val shard: Optional<DiscordShard> = Optional.Missing(), val presence: Optional<DiscordPresence> = Optional.Missing(), val intents: Intents) : Command
Link copied to clipboard
data class IdentifyProperties(val os: String, val browser: String, val device: String)
Link copied to clipboard
data class IntegrationCreate(val integration: DiscordIntegration, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class IntegrationDelete(val integration: DiscordIntegrationDelete, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class IntegrationUpdate(val integration: DiscordIntegration, val sequence: Int?) : DispatchEvent
Link copied to clipboard
sealed class Intent

Values that enable a group of events as defined by Discord.

Link copied to clipboard

A collection of multiple Intents.

Link copied to clipboard
data class InteractionCreate(val interaction: DiscordInteraction, val sequence: Int?) : DispatchEvent
Link copied to clipboard
Link copied to clipboard
data class InviteCreate(val invite: DiscordCreatedInvite, val sequence: Int?) : DispatchEvent

Sent when a new invite to a channel is created.

Link copied to clipboard
data class InviteDelete(val invite: DiscordDeletedInvite, val sequence: Int?) : DispatchEvent

Sent when an invite is deleted.

Link copied to clipboard
data class MessageCreate(val message: DiscordMessage, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class MessageDelete(val message: DeletedMessage, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class MessageDeleteBulk(val messageBulk: BulkDeleteData, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class MessageReactionAdd(val reaction: MessageReactionAddData, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class MessageReactionRemove(val reaction: MessageReactionRemoveData, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class MessageReactionRemoveAll(val reactions: AllRemovedMessageReactions, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class MessageReactionRemoveEmoji(val reaction: DiscordRemovedEmoji, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class MessageUpdate(val message: DiscordPartialMessage, val sequence: Int?) : DispatchEvent
Link copied to clipboard
Link copied to clipboard
data class PresenceUpdate(val presence: DiscordPresenceUpdate, val sequence: Int?) : DispatchEvent
Link copied to clipboard

Some Intents are defined as "privileged" due to the sensitive nature of the data and cannot be used by Kord without enabling them.

Link copied to clipboard
data class Ready(val data: ReadyData, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class ReadyData(val version: Int, val user: DiscordUser, val privateChannels: List<DiscordChannel>, val guilds: List<DiscordUnavailableGuild>, val sessionId: String, val resumeGatewayUrl: String, val geoOrderedRtcRegions: Optional<JsonElement?> = Optional.Missing(), val guildHashes: Optional<JsonElement?> = Optional.Missing(), val application: Optional<JsonElement?> = Optional.Missing(), val traces: List<String>, val shard: Optional<DiscordShard> = Optional.Missing())
Link copied to clipboard
object Reconnect : Event
Link copied to clipboard
data class RequestGuildMembers(val guildId: Snowflake, val query: Optional<String> = Optional.Missing(), val limit: OptionalInt = OptionalInt.Missing, val presences: OptionalBoolean = OptionalBoolean.Missing, val userIds: Optional<Set<Snowflake>> = Optional.Missing(), val nonce: Optional<String> = Optional.Missing()) : Command

A representation of the Discord Request Guild Members command.

Link copied to clipboard
data class Resume(val token: String, val sessionId: String, val sequenceNumber: Int) : Command
Link copied to clipboard
data class Resumed(val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class SubscriptionCreate(val subscription: DiscordSubscription, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class SubscriptionDelete(val subscription: DiscordSubscription, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class SubscriptionUpdate(val subscription: DiscordSubscription, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class ThreadCreate(val channel: DiscordChannel, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class ThreadDelete(val channel: DiscordChannel, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class ThreadListSync(val sync: DiscordThreadListSync, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class ThreadMembersUpdate(val members: DiscordThreadMembersUpdate, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class ThreadMemberUpdate(val member: DiscordThreadMember, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class ThreadUpdate(val channel: DiscordChannel, val sequence: Int?) : DispatchEvent
Link copied to clipboard
class Ticker(dispatcher: CoroutineDispatcher = Dispatchers.Default) : CoroutineScope

A reusable fixed rate ticker.

Link copied to clipboard
data class TypingStart(val data: DiscordTyping, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class UnknownDispatchEvent(val name: String?, val data: JsonElement?, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class UpdateStatus(val since: InstantInEpochMilliseconds?, val activities: List<DiscordBotActivity>, val status: PresenceStatus, val afk: Boolean) : Command
Link copied to clipboard
data class UpdateVoiceStatus(val guildId: Snowflake, val channelId: Snowflake?, val selfMute: Boolean, val selfDeaf: Boolean) : Command
Link copied to clipboard
data class UserUpdate(val user: DiscordUser, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class VoiceServerUpdate(val voiceServerUpdateData: DiscordVoiceServerUpdateData, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class VoiceStateUpdate(val voiceState: DiscordVoiceState, val sequence: Int?) : DispatchEvent
Link copied to clipboard
data class WebhooksUpdate(val webhooksUpdateData: DiscordWebhooksUpdateData, val sequence: Int?) : DispatchEvent

Properties

Link copied to clipboard
val <Error class: unknown class>.ALL: Intents

All known Intents (as contained in Intent.entries) combined into a single Intents instance.

Link copied to clipboard
val <Error class: unknown class>.NON_PRIVILEGED: Intents

All known non-privileged Intents combined into a single Intents instance.

Link copied to clipboard
val <Error class: unknown class>.NONE: Intents

An Intents instance that contains no Intents.

Link copied to clipboard
val <Error class: unknown class>.PRIVILEGED: Intents

All known privileged Intents combined into a single Intents instance.

Functions

Link copied to clipboard
inline fun DefaultGateway(builder: DefaultGatewayBuilder.() -> Unit = {}): DefaultGateway
Link copied to clipboard
inline suspend fun Gateway.editPresence(builder: PresenceBuilder.() -> Unit)
Link copied to clipboard
fun Intents(vararg flags: Intent): Intents
fun Intents(vararg flags: Intents): Intents
@JvmName(name = "Intents0")
fun Intents(flags: Iterable<Intents>): Intents

Returns an instance of Intents that has all bits set that are set in any element of flags.

inline fun Intents(builder: Intents.Builder.() -> Unit = {}): Intents

Returns an instance of Intents built with Intents.Builder.

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
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.