Kord Extensions Help

Commands

The command builders allow you to configure Kord Extensions' command frameworks. Currently, 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

For more information on commands and how to write them, see the dedicated documentation for them.

Application Commands

The applicationCommands builder allows you to configure the Kord Extensions application commands framework, which includes context (user and message) commands and slash commands.

ExtensibleBot(TOKEN) { // ... applicationCommands { defaultGuild(TEST_GUILD_ID) } }

Builders

Builder

Receiver

Description

applicationCommandRegistry

Register a callable object (usually a constructor) that returns an alternative implementation of the ApplicationCommandRegistry type.

messageCommandCheck

MessageCommandCheck

Register a check that will apply to all registered message commands.

slashCommandCheck

SlashCommandCheck

Register a check that will apply to all registered slash commands.

userCommandCheck

UserCommandCheck

Register a check that will apply to all registered user commands.

Functions

Function

Parameters

Description

defaultGuild

Snowflake?

Specify a guild to register all global application commands to. This is intended for testing, and will apply to all application commands that don't have a registration guild specified.

defaultGuild

String?

Specify a guild to register all global application commands to. This is intended for testing, and will apply to all application commands that don't have a registration guild specified.

defaultGuild

ULong?

Specify a guild to register all global application commands to. This is intended for testing, and will apply to all application commands that don't have a registration guild specified.

Properties

Name

Type

Default

Description

enabled

Boolean

true

Whether the application commands framework should be enabled. If your bot does not use application commands, setting this to false will completely disable them.

register

Boolean

true

Whether application commands should be registered with Discord automatically. Set this to false if you only want your bot to process commands, rather than registering them.

Chat Commands

The applicationCommands builder allows you to configure the Kord Extensions chat commands framework, which handles the parsing and processing of chat commands.

ExtensibleBot(TOKEN) { // ... chatCommands { defaultPrefix = "!" enabled = true invokeOnMention = true } }

Builders

Builder

Receiver

Parameters

Description

check

MessageCreateEvent

Register a check that will apply to all registered chat commands.

prefix

MessageCreateEvent

String

Set the prefix callback, which allows you to provide different command prefixes for different contexts. The String parameter represents the configured default prefix, which should be returned by the callback if no custom prefix is required.

registry

MessageCreateEvent

Register a callable object (usually a constructor) that returns an alternative implementation of the ChatCommandRegistry type.

Properties

Name

Type

Default

Description

defaultPrefix

String

"!"

The default command prefix, required before the name of a chat command at the start of a message. The prefix builder may be used when dynamic command prefixes are required.

enabled

Boolean

false

Whether the chat commands framework should be enabled. If your bot uses chat commands, setting this to true will enable them.

ignoreSelf

Boolean

true

Whether to ignore messages sent by the bot, and thus avoid executing commands invoked by it.

invokeOnMention

Boolean

true

Whether users should be able to run chat commands by mentioning the bot at the start of their message, instead of using the configured prefix.

Last modified: 03 September 2024