Kord

class Kord(resources: ClientResources, cache: DataCache, gateway: MasterGateway, rest: RestClient, selfId: Snowflake, eventFlow: MutableSharedFlow<Event>, dispatcher: CoroutineDispatcher, interceptorBuilder: () -> GatewayEventInterceptor) : CoroutineScope

The central adapter between other Kord modules and source of core events.

Constructors

Kord
Link copied to clipboard
fun Kord(resources: ClientResources, cache: DataCache, gateway: MasterGateway, rest: RestClient, selfId: Snowflake, eventFlow: MutableSharedFlow<Event>, dispatcher: CoroutineDispatcher, interceptorBuilder: () -> GatewayEventInterceptor = { DefaultGatewayEventInterceptor(cache) })

Types

Companion
Link copied to clipboard
object Companion

Functions

bulkEditApplicationCommandPermissions
Link copied to clipboard
inline suspend fun bulkEditApplicationCommandPermissions(guildId: Snowflake, builder: ApplicationCommandPermissionsBulkModifyBuilder.() -> Unit)
createGlobalApplicationCommands
Link copied to clipboard
inline suspend fun createGlobalApplicationCommands(builder: MultiApplicationCommandBuilder.() -> Unit): Flow<GlobalApplicationCommand>
createGlobalChatInputCommand
Link copied to clipboard
inline suspend fun createGlobalChatInputCommand(name: String, description: String, builder: ChatInputCreateBuilder.() -> Unit = {}): GlobalChatInputCommand
createGlobalMessageCommand
Link copied to clipboard
inline suspend fun createGlobalMessageCommand(name: String, builder: MessageCommandCreateBuilder.() -> Unit = {}): GlobalMessageCommand
createGlobalUserCommand
Link copied to clipboard
inline suspend fun createGlobalUserCommand(name: String, builder: UserCommandCreateBuilder.() -> Unit = {}): GlobalUserCommand
createGuild
Link copied to clipboard
@DeprecatedSinceKord(version = 0.7.0)
inline suspend fun createGuild(builder: GuildCreateBuilder.() -> Unit): Guild
Requests to create a new Guild configured through the builder.
inline suspend fun createGuild(name: String, builder: GuildCreateBuilder.() -> Unit): Guild
Requests to create a new Guild configured through the builder.
createGuildApplicationCommands
Link copied to clipboard
inline suspend fun createGuildApplicationCommands(guildId: Snowflake, builder: MultiApplicationCommandBuilder.() -> Unit): Flow<GuildApplicationCommand>
createGuildChatInputCommand
Link copied to clipboard
inline suspend fun createGuildChatInputCommand(guildId: Snowflake, name: String, description: String, builder: ChatInputCreateBuilder.() -> Unit = {}): GuildChatInputCommand
createGuildMessageCommand
Link copied to clipboard
inline suspend fun createGuildMessageCommand(guildId: Snowflake, name: String, builder: MessageCommandCreateBuilder.() -> Unit = {}): GuildMessageCommand
createGuildUserCommand
Link copied to clipboard
inline suspend fun createGuildUserCommand(guildId: Snowflake, name: String, builder: UserCommandCreateBuilder.() -> Unit = {}): GuildUserCommand
editApplicationCommandPermissions
Link copied to clipboard
inline suspend fun editApplicationCommandPermissions(guildId: Snowflake, commandId: Snowflake, builder: ApplicationCommandPermissionsModifyBuilder.() -> Unit)
editPresence
Link copied to clipboard
inline suspend fun editPresence(builder: PresenceBuilder.() -> Unit)
Requests to edit the presence of the bot user configured by the builder.
editSelf
Link copied to clipboard
suspend fun editSelf(builder: CurrentUserModifyBuilder.() -> Unit): User
equals
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
getApplicationInfo
Link copied to clipboard
suspend fun getApplicationInfo(): ApplicationInfo
getChannel
Link copied to clipboard
suspend fun getChannel(id: Snowflake, strategy: EntitySupplyStrategy<*> = resources.defaultStrategy): Channel?
Requests to get the Channel with the id through the strategy, returns null if the Channel isn't present.
getChannelOf
Link copied to clipboard
inline suspend fun <T : Channel> getChannelOf(id: Snowflake, strategy: EntitySupplyStrategy<*> = resources.defaultStrategy): T?
Requests to get the Channel as type T through the strategy, returns null if the Channel isn't present or is not of type T.
getGlobalApplicationCommand
Link copied to clipboard
suspend fun getGlobalApplicationCommand(commandId: Snowflake): GlobalApplicationCommand
getGlobalApplicationCommandOf
Link copied to clipboard
suspend fun <T> getGlobalApplicationCommandOf(commandId: Snowflake): T
getGlobalApplicationCommandOfOrNull
Link copied to clipboard
suspend fun <T> getGlobalApplicationCommandOfOrNull(commandId: Snowflake): T?
getGlobalApplicationCommandOrNull
Link copied to clipboard
suspend fun getGlobalApplicationCommandOrNull(commandId: Snowflake): GlobalApplicationCommand?
getGuild
Link copied to clipboard
suspend fun getGuild(id: Snowflake, strategy: EntitySupplyStrategy<*> = resources.defaultStrategy): Guild?
getGuildApplicationCommand
Link copied to clipboard
suspend fun getGuildApplicationCommand(guildId: Snowflake, commandId: Snowflake): GuildApplicationCommand
getGuildApplicationCommandOf
Link copied to clipboard
inline suspend fun <T : GuildApplicationCommand> getGuildApplicationCommandOf(guildId: Snowflake, commandId: Snowflake): T
getGuildApplicationCommandOfOrNull
Link copied to clipboard
inline suspend fun <T : GuildApplicationCommand> getGuildApplicationCommandOfOrNull(guildId: Snowflake, commandId: Snowflake): T?
getGuildApplicationCommandOrNull
Link copied to clipboard
suspend fun getGuildApplicationCommandOrNull(guildId: Snowflake, commandId: Snowflake): GuildApplicationCommand?
getGuildApplicationCommands
Link copied to clipboard
fun getGuildApplicationCommands(guildId: Snowflake): Flow<GuildApplicationCommand>
getGuildPreview
Link copied to clipboard
suspend fun getGuildPreview(guildId: Snowflake, strategy: EntitySupplyStrategy<*> = resources.defaultStrategy): GuildPreview
Requests to get the GuildPreview of a guild with the guildId through the strategy, returns null if the GuildPreview isn't present.
getGuildPreviewOrNull
Link copied to clipboard
suspend fun getGuildPreviewOrNull(guildId: Snowflake, strategy: EntitySupplyStrategy<*> = resources.defaultStrategy): GuildPreview?
Requests to get the GuildPreview of a guild with the guildId through the strategy, returns null if the GuildPreview isn't present.
getInvite
Link copied to clipboard
suspend fun getInvite(code: String, withCounts: Boolean): Invite?
Requests to get the Invite with code through the EntitySupplyStrategy.rest.
getSelf
Link copied to clipboard
suspend fun getSelf(strategy: EntitySupplyStrategy<*> = resources.defaultStrategy): User
Requests to get the User that represents this bot account through the strategy,
getUser
Link copied to clipboard
suspend fun getUser(id: Snowflake, strategy: EntitySupplyStrategy<*> = resources.defaultStrategy): User?
Requests to get the User that with the id through the strategy,
getWebhook
Link copied to clipboard
suspend fun getWebhook(id: Snowflake, strategy: EntitySupplyStrategy<*> = resources.defaultStrategy): Webhook
Requests to get the Webhook in this guild.
getWebhookOrNull
Link copied to clipboard
suspend fun getWebhookOrNull(id: Snowflake, strategy: EntitySupplyStrategy<*> = resources.defaultStrategy): Webhook?
Requests to get the Webhook in this guild with an authentication token, returns null if the webhook was not present.
getWebhookWithToken
Link copied to clipboard
suspend fun getWebhookWithToken(id: Snowflake, token: String, strategy: EntitySupplyStrategy<*> = resources.defaultStrategy): Webhook
Requests to get the Webhook in this guild with an authentication token.
getWebhookWithTokenOrNull
Link copied to clipboard
suspend fun getWebhookWithTokenOrNull(id: Snowflake, token: String, strategy: EntitySupplyStrategy<*>): Webhook?
Requests to get the Webhook in this guild with an authentication token, returns null if the webhook was not present.
login
Link copied to clipboard
inline suspend fun login(builder: LoginBuilder.() -> Unit = {})
Logs in to the configured Gateways.
logout
Link copied to clipboard
suspend fun logout()
Logs out to the configured Gateways.
shutdown
Link copied to clipboard
suspend fun shutdown()
Logs out of all connected Gateways and frees all resources.
toString
Link copied to clipboard
open override fun toString(): String
with
Link copied to clipboard
fun <T : EntitySupplier> with(strategy: EntitySupplyStrategy<T>): T

Properties

cache
Link copied to clipboard
val cache: DataCache
coroutineContext
Link copied to clipboard
open override val coroutineContext: CoroutineContext
defaultSupplier
Link copied to clipboard
val defaultSupplier: EntitySupplier
The default supplier, obtained through Kord's resources and configured through KordBuilder.defaultStrategy.
events
Link copied to clipboard
val events: SharedFlow<Event>
The events emitted from the gateway.
gateway
Link copied to clipboard
val gateway: MasterGateway
globalCommands
Link copied to clipboard
val globalCommands: Flow<GlobalApplicationCommand>
Global commands made by the bot under this Kord instance.
guilds
Link copied to clipboard
val guilds: Flow<Guild>
regions
Link copied to clipboard
val regions: Flow<Region>
resources
Link copied to clipboard
val resources: ClientResources
rest
Link copied to clipboard
val rest: RestClient
selfId
Link copied to clipboard
val selfId: Snowflake
unsafe
Link copied to clipboard
val unsafe: Unsafe
A reference to all exposed unsafe entity constructors for this instance.

Extensions

on
Link copied to clipboard
inline fun <T : Event> Kord.on(scope: CoroutineScope = this, noinline consumer: suspend T.() -> Unit): Job
Convenience method that will invoke the consumer on every event T created by Kord.events.

Sources

jvm source
Link copied to clipboard