Kord

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

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

Constructors

Link copied to clipboard
constructor(resources: ClientResources, cache: DataCache, gateway: MasterGateway, rest: RestClient, selfId: Snowflake, eventFlow: MutableSharedFlow<Event>, dispatcher: CoroutineDispatcher, interceptor: GatewayEventInterceptor)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val cache: DataCache
Link copied to clipboard
Link copied to clipboard

The default supplier, obtained through Kord's resources and configured through KordBuilder.defaultStrategy. By default a strategy from EntitySupplyStrategy.rest.

Link copied to clipboard

The events emitted from the gateway. Call Kord.login to start receiving events.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

A reference to all exposed unsafe entity constructors for this instance.

Functions

Link copied to clipboard
inline suspend fun createGlobalChatInputCommand(name: String, description: String, builder: GlobalChatInputCreateBuilder.() -> Unit = {}): GlobalChatInputCommand
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
inline suspend fun createGuild(name: String, builder: GuildCreateBuilder.() -> Unit): Guild

Requests to create a new Guild configured through the builder.

Link copied to clipboard
inline suspend fun createGuildChatInputCommand(guildId: Snowflake, name: String, description: String, builder: ChatInputCreateBuilder.() -> Unit = {}): GuildChatInputCommand
Link copied to clipboard
inline suspend fun createGuildMessageCommand(guildId: Snowflake, name: String, builder: MessageCommandCreateBuilder.() -> Unit = {}): GuildMessageCommand
Link copied to clipboard
inline suspend fun createGuildUserCommand(guildId: Snowflake, name: String, builder: UserCommandCreateBuilder.() -> Unit = {}): GuildUserCommand
Link copied to clipboard
inline suspend fun editPresence(builder: PresenceBuilder.() -> Unit)

Requests to edit the presence of the bot user configured by the builder. The new presence will be shown on all shards. Use MasterGateway.gateways or Event.gateway to set the presence of a single shard.

Link copied to clipboard
suspend fun editSelf(builder: CurrentUserModifyBuilder.() -> Unit): User
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
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.

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.

Link copied to clipboard
inline fun getEntitlements(strategy: EntitySupplyStrategy<*> = resources.defaultStrategy, builder: EntitlementsListRequestBuilder.() -> Unit = {}): Flow<Entitlement>

Requests to get all Entitlements for this application.

Link copied to clipboard
@JvmName(name = "getGlobalApplicationCommandOfJvmInlineReplacement")
inline suspend fun <T : GlobalApplicationCommand> getGlobalApplicationCommandOf(commandId: Snowflake): T
Link copied to clipboard
@JvmName(name = "getGlobalApplicationCommandOfOrNullJvmInlineReplacement")
inline suspend fun <T : GlobalApplicationCommand> getGlobalApplicationCommandOfOrNull(commandId: Snowflake): T?
Link copied to clipboard
Link copied to clipboard
suspend fun getGuild(id: Snowflake, strategy: EntitySupplyStrategy<*> = resources.defaultStrategy): Guild

Requests the Guild with the given id.

Link copied to clipboard
Link copied to clipboard
inline suspend fun <T : GuildApplicationCommand> getGuildApplicationCommandOf(guildId: Snowflake, commandId: Snowflake): T
Link copied to clipboard
inline suspend fun <T : GuildApplicationCommand> getGuildApplicationCommandOfOrNull(guildId: Snowflake, commandId: Snowflake): T?
Link copied to clipboard
fun getGuildApplicationCommands(guildId: Snowflake, withLocalizations: Boolean? = null): Flow<GuildApplicationCommand>
Link copied to clipboard
suspend fun getGuildOrNull(id: Snowflake, strategy: EntitySupplyStrategy<*> = resources.defaultStrategy): Guild?

Requests the Guild with the given id, returns null when the guild isn't present.

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.

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.

Link copied to clipboard
suspend fun getInvite(code: String, withCounts: Boolean = true, withExpiration: Boolean = true, scheduledEventId: Snowflake? = null): Invite

Requests to get the Invite represented by the code.

Link copied to clipboard
suspend fun getInviteOrNull(code: String, withCounts: Boolean = true, withExpiration: Boolean = true, scheduledEventId: Snowflake? = null): Invite?

Requests to get the Invite represented by the code, returns null if the Invite isn't present.

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,

Link copied to clipboard
suspend fun getSkus(): List<Sku>

Requests to get all Skus for this application.

Link copied to clipboard
suspend fun getSticker(id: Snowflake): Sticker
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,

Link copied to clipboard
suspend fun getWebhook(id: Snowflake, strategy: EntitySupplyStrategy<*> = resources.defaultStrategy): Webhook

Requests to get the Webhook in this guild.

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.

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.

Link copied to clipboard
suspend fun getWebhookWithTokenOrNull(id: Snowflake, token: String, 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.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
inline suspend fun login(builder: LoginBuilder.() -> Unit = {})

Logs in to the configured Gateways. Suspends until logout or shutdown is called.

Link copied to clipboard
suspend fun logout()

Logs out to the configured Gateways.

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.

Link copied to clipboard
suspend fun shutdown()

Logs out of all connected Gateways and frees all resources.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard