Commands
The command builders allow you to configure Kord Extensions' command frameworks. Kord Extensions supports two primary command types:
- Application commands, which include message, slash, and user commands
- Chat commands, which are commands via messages in Discord channels
With the introduction of slash commands, Kord Extensions has elected to de-prioritise chat commands. This means that we disable them by default, and you'll need to enable them if you want to use them.
We intend to support chat commands indefinitely. However, please note that most bots don't use them, and this means that there may be subtle or unknown bugs present within the chat commands framework. If you notice anything unusual or broken, please don't hesitate to submit a Pull Request, open an issue, or contact us on Discord.
For more information on commands and how to write them, see [this page] and [that page].
Application Commands
The applicationCommands { } builder allows you to configure the application commands framework,
which includes context (user and message) commands and slash commands.
ExtensibleBot(TOKEN) {
// ...
applicationCommands {
defaultGuild(TEST_GUILD_ID)
}
}
Builders
Register a callback that constructs and returns an alternative implementation of the ApplicationCommandRegistry
type, if needed.
Register a check that will apply to all of your bot's message commands.
Register a check that will apply to all of your bot's slash commands.
Register a check that will apply to all of your bot's user commands.
Functions
Specify a guild to register all global application commands to. This will apply to all application commands that don't have a default guild specified.
This function sets the defaultGuild property, which you can set manually instead if you prefer.
ID representing the required default guild.
Properties
Whether application commands should be enabled.
Setting this to false disables the entire feature.
Whether to automatically register commands with Discord, both during and after startup.
Setting this to false only prevents command registration --- users can still run commands.
This may be useful for multi-process bots, or bots with commands you register externally.
Chat Commands
The chatCommands { } builder allows you to configure the chat commands framework,
which handles the parsing and processing of chat commands.
ExtensibleBot(TOKEN) {
// ...
chatCommands {
defaultPrefix = "!"
enabled = true
invokeOnMention = true
}
}
Builders
Register a check that will apply to all of your bot's chat commands.
Set the prefix callback, which allows you to provide different command prefixes for different contexts.
The configured default prefix. Your lambda should return this if no custom prefix is required.
Register a callback that constructs and returns an alternative implementation of the ChatCommandRegistry
type, if needed.
Properties
The default command prefix, required before the name of a chat command at the start of a message.
Use the prefix { } builder to supply a dynamic command prefix.
Whether chat commands should be enabled.
Leaving this set to false disables the entire feature.
As it's disabled by default, you'll need to set this to true if you need your bot to support chat commands.
Whether to ignore messages sent by this bot.
Setting this to false means that the bot will execute commands based on the content of its own messages.
Whether users should be able to execute commands by mentioning/pinging the bot at the start of the message, instead of using a command prefix.