JDATextCommandVariation

@Target(allowedTargets = [AnnotationTarget.FUNCTION])
annotation class JDATextCommandVariation(val path: Array<String>, val order: Int = 0, val description: String = "", val usage: String = "", val example: String = "")(source)

Declares this function as a text command, additional properties can be set with @TextCommandData.

Additional annotations

Additional data can be set by using @TextCommandData once per top-level name, by specifying their target path.

Text command variations

A given text command path (such as ban temp) is composed of at least one variation; Each variation has different parameters, and will display separately in the built-in help content.

Each variation runs based off its priority, the first variation that has a full match against the user input gets executed.

If no regex-based variation (using a BaseCommandEvent) matches, the fallback variation is executed (if a variation using CommandEvent exists).

If no variation matches and there is no fallback, then the help content is invoked for the command.

Note on command complexity

You might have errors if your command is considered too complex. Several factors can increase the chance of a command being unusable, such as

  • Too many optionals

  • Options with a dynamic number of spaces (such as strings)

Attempts at fixing the issue can include moving the parameters around, like avoiding 2 strings next to each other.

Requirements

Option types

Permissions

Required user/bot permissions can be set with @UserPermissions/@BotPermissions.

Execution filtering

You can arbitrarily prevent execution of commands by using @Filter, passing an implementation of TextCommandFilter.

Rate limiting

See @RateLimit / @Cooldown. The annotations apply to the command itself, not only this variation, in other words, this applies to all commands with the same path.

See also

@Category

@Hidden

@NSFW

Declaring text commands using the DSL

Properties

Link copied to clipboard

Short description of the command displayed in the built-in help command, below the command usage.

Link copied to clipboard

Example command for this command variation, the built-in help command already sets the prefix and command name, with a space at the end.

Link copied to clipboard
val order: Int = 0

Specifies the priority of this text command variation (1 is the most important).

Link copied to clipboard

Path components of the command, limited to three components and composed of a-zA-Z1-9_-

Link copied to clipboard

Usage string for this command variation, the built-in help command already sets the prefix and command name, with a space at the end.