Package me.jakejmattson.discordkt.api.dsl

Primary builders and events used to develop bots.

Types

Bot
Link copied to clipboard
class Bot(token: String, packageName: String)
Backing class for bot function.
BotConfiguration
Link copied to clipboard
data class BotConfiguration(packageName: String, allowMentionPrefix: Boolean, showStartupLog: Boolean, generateCommandDocs: Boolean, recommendCommands: Boolean, enableSearch: Boolean, commandReaction: DiscordEmoji?, theme: Color?, intents: Intents, entitySupplyStrategy: EntitySupplyStrategy<*>, prefix: suspend (DiscordContext) -> String, mentionEmbed: suspend EmbedBuilder.(DiscordContext) -> Unit?)
Contains all properties configured when the bot is created.
Command
Link copied to clipboard
sealed class Command
CommandEvent
Link copied to clipboard
open class CommandEvent<T : TypeContainer>(rawInputs: RawInputs, discord: Discord, message: Message?, author: User, channel: MessageChannel, guild: Guild?) : Responder
A generic command execution event.
CommandSet
Link copied to clipboard
class CommandSet(category: String, requiredPermissionLevel: Enum<*>?, collector: CommandSetBuilder.() -> Unit) : BuilderRegister
This is not for you...
CommandSetBuilder
Link copied to clipboard
data class CommandSetBuilder(discord: Discord, category: String, requiredPermission: Enum<*>)
DSL used to build a set of commands.
Data
Link copied to clipboard
abstract class Data(path: String, killIfGenerated: Boolean)
A class that represents some data in a JSON file.
DiscordContext
Link copied to clipboard
open class DiscordContext(discord: Discord, message: Message, guild: Guild?, author: User, channel: MessageChannelBehavior) : Responder
The discord context of the command execution.
DktButton
Link copied to clipboard
interface DktButton
Used internally to represent a button.
DmCommand
Link copied to clipboard
class DmCommand(names: List<String>, description: String, requiredPermission: Enum<*>) : Command
A command that can only be executed in a DM.
DmCommandEvent
Link copied to clipboard
data class DmCommandEvent<T : TypeContainer>(rawInputs: RawInputs, discord: Discord, message: Message, author: User, channel: DmChannel, guild: Guild?) : CommandEvent<T>
An event that can only be fired in a DM.
Execution
Link copied to clipboard
data class Execution<T : CommandEvent<*>>(arguments: List<ArgumentType<*>>, action: suspend T.() -> Unit)
The bundle of information to be executed when a command is invoked.
GlobalCommand
Link copied to clipboard
open class GlobalCommand(names: List<String>, description: String, requiredPermission: Enum<*>) : Command
A command that can be executed from anywhere.
GlobalSlashCommand
Link copied to clipboard
class GlobalSlashCommand(name: String, description: String, requiredPermission: Enum<*>) : Command
A command wrapper for a global discord slash command.
GuildCommand
Link copied to clipboard
open class GuildCommand(names: List<String>, description: String, requiredPermission: Enum<*>) : Command
A command that can only be executed in a guild.
GuildCommandEvent
Link copied to clipboard
data class GuildCommandEvent<T : TypeContainer>(rawInputs: RawInputs, discord: Discord, message: Message, author: User, channel: TextChannel, guild: Guild) : CommandEvent<T>
An event that can only be fired in a guild.
GuildSlashCommand
Link copied to clipboard
class GuildSlashCommand(name: String, description: String, requiredPermission: Enum<*>) : Command
A command wrapper for a guild discord slash command.
Listeners
Link copied to clipboard
class Listeners(collector: ListenerBuilder.() -> Unit) : BuilderRegister
This is not for you...
Menu
Link copied to clipboard
data class Menu(pages: MutableList<EmbedBuilder>, buttons: MutableList<MutableList<DktButton>>)
Contains menu data and navigation functions.
MenuBuilder
Link copied to clipboard
class MenuBuilder
Type-safe builder for creating paginated embeds with button components.
MenuButtonRowBuilder
Link copied to clipboard
class MenuButtonRowBuilder
Builder functions for menu buttons.
PermissionBundle
Link copied to clipboard
class PermissionBundle(levels: List<Enum<*>>, commandDefault: Enum<*>)
Permission values and helper functions.
PermissionContext
Link copied to clipboard
data class PermissionContext(discord: Discord, user: User, guild: Guild?)
Holds information used to determine if a command has permission to run.
PermissionSet
Link copied to clipboard
interface PermissionSet
The interface that all permission enums must inherit from.
Precondition
Link copied to clipboard
class Precondition(priority: Int, construct: suspend PreconditionBuilder.() -> Unit) : BuilderRegister
This is not for you...
RawInputs
Link copied to clipboard
data class RawInputs(rawMessageContent: String, commandName: String, prefixCount: Int, commandArgs: List<String>)
Data class containing the raw information from the command execution.
Responder
Link copied to clipboard
interface Responder
An interface for responding to input in a given context.
SimpleConfiguration
Link copied to clipboard
data class SimpleConfiguration(allowMentionPrefix: Boolean, showStartupLog: Boolean, generateCommandDocs: Boolean, recommendCommands: Boolean, enableSearch: Boolean, commandReaction: DiscordEmoji?, theme: Color?, intents: Intents, entitySupplyStrategy: EntitySupplyStrategy<*>)
Holds all basic configuration options.
SlashCommandEvent
Link copied to clipboard
data class SlashCommandEvent<T : TypeContainer>(rawInputs: RawInputs, discord: Discord, message: Message?, author: User, channel: MessageChannel, guild: Guild?) : CommandEvent<T>
An event fired by a slash command.

Functions

bot
Link copied to clipboard
@KordPreview()
fun bot(token: String, configure: suspend Bot.() -> Unit)
Create an instance of your Discord bot!
commands
Link copied to clipboard
fun commands(category: String, requiredPermissionLevel: Enum<*>? = null, construct: CommandSetBuilder.() -> Unit): CommandSet
Create a block for registering commands.
get
Link copied to clipboard
operator fun MutableList<Command>.get(query: String): Command?
Get a command by its name (case insensitive).
listeners
Link copied to clipboard
fun listeners(construct: ListenerBuilder.() -> Unit): Listeners
Create a block for registering listeners.
precondition
Link copied to clipboard
fun precondition(priority: Int = 5, construct: suspend PreconditionBuilder.() -> Unit): Precondition
Create a block for registering preconditions.