Package me.jakejmattson.discordkt.dsl

Primary builders and events used to develop bots.

Types

Link copied to clipboard
class Bot(token: String, packageName: String)

Backing class for bot function.

Link copied to clipboard
data class BotConfiguration(    val packageName: String,     val mentionAsPrefix: Boolean,     val logStartup: Boolean,     val documentCommands: Boolean,     val recommendCommands: Boolean,     val searchCommands: Boolean,     val deleteInvocation: Boolean,     val dualRegistry: Boolean,     val commandReaction: DiscordEmoji?,     val theme: Color?,     val intents: Intents,     val defaultPermissions: Permissions,     val entitySupplyStrategy: EntitySupplyStrategy<*>,     prefix: suspend (DiscordContext) -> String,     mentionEmbed: Pair<String?, suspend EmbedBuilder.(DiscordContext) -> Unit?>,     exceptionHandler: suspend DktException<*>.() -> Unit)

Contains all properties configured when the bot is created.

Link copied to clipboard
class CommandException<T : Exception>(exception: T, val event: CommandEvent<*>) : DktException<T>

Contains an exception thrown from a command event.

Link copied to clipboard
abstract class Data

A serializable class that represents some data.

Link copied to clipboard
interface DktButton

Used internally to represent a button.

Link copied to clipboard
sealed class DktException<T : Exception>

Shared interface for handling exceptions.

Link copied to clipboard
class ListenerException<T : Exception>(exception: T, val event: Event) : DktException<T>

Contains an exception thrown from a listener.

Link copied to clipboard
class Listeners(collector: ListenerBuilder.() -> Unit) : BuilderRegister

This is not for you...

Link copied to clipboard
data class Menu(pages: MutableList<EmbedBuilder>, buttons: MutableList<MutableList<DktButton>>)

Contains menu data and navigation functions.

Link copied to clipboard
class MenuBuilder

Type-safe builder for creating paginated embeds with button components.

Link copied to clipboard
class MenuButtonRowBuilder

Builder functions for menu buttons.

Link copied to clipboard
class Precondition(priority: Int, construct: suspend PreconditionBuilder.() -> Unit) : BuilderRegister

This is not for you...

Link copied to clipboard
interface Responder

An interface for responding to input in a given context.

Link copied to clipboard
data class SimpleConfiguration(    var mentionAsPrefix: Boolean = true,     var logStartup: Boolean = true,     var documentCommands: Boolean = true,     var recommendCommands: Boolean = true,     var searchCommands: Boolean = true,     var deleteInvocation: Boolean = true,     var dualRegistry: Boolean = true,     var commandReaction: DiscordEmoji? = Emojis.eyes,     var theme: Color? = null,     var intents: Intents = Intents.none,     var defaultPermissions: Permissions = Permissions(Permission.UseApplicationCommands),     var entitySupplyStrategy: EntitySupplyStrategy<*> = EntitySupplyStrategy.cacheWithCachingRestFallback)

Simple configuration values that don't require a builder.

Link copied to clipboard
interface SlashResponder : Responder

A modified responder for slash commands.

Functions

Link copied to clipboard
@KordPreview
fun bot(token: String?, configure: suspend Bot.() -> Unit)

Create an instance of your Discord bot! You can use the following blocks to modify bot configuration: prefix, configure, mentionEmbed, presence, localeOf, onStart

Link copied to clipboard
fun <T : Data> T.edit(edits: T.() -> Unit)

Apply an edit to a Data and save to file.

suspend fun Message.edit(menu: Menu): Message

Replace an existing message with a Menu.

Link copied to clipboard
fun listeners(construct: ListenerBuilder.() -> Unit): Listeners

Create a block for registering listeners.

Link copied to clipboard
suspend fun menu(menuBuilder: suspend MenuBuilder.() -> Unit): Menu

Create a Menu

Link copied to clipboard
fun precondition(priority: Int = 5, construct: suspend PreconditionBuilder.() -> Unit): Precondition

Create a block for registering preconditions.