Skip to content

Slash Command Cooldown

Note

The cooldown API is an old and rarely used feature. Thus, revisiting it isn't a top priority in JDA-Commands development. If you want it to be improved, feel free to open an issue.

Slash commands can have a cooldown to limit their usage. The cooldown is applied globally, per user, per command. You can add a cooldown by annotating a slash command method with @Cooldown.

Example

@Cooldown(value = 5, timeUnit = TimeUnit.MINUTES)
@SlashCommand("example")
public void onCommand(CommandEvent event) {
    ...
}

If a command still has a cooldown, an error message gets sent to the user.

Cooldown Error Message

You can customize this error message, find more about it here.