Skip to content

Command Checks

While JDA may have Command Privileges, this library uses a different, custom system: Slash Command Checks. It's just a glorified list of (SlashCommandContext) -> Boolean.

When a SlashCommandEvent is received, and the command's name matches the command object's name, all of its checks are looped through and checked. If one (or more) checks fail, the command call is aborted and the request is automatically replied to with an embed describing what the issue was, using formats defined in your SlashCommandClientConfig.

Example Command Check Usage
    init {
        //Yes I'm aware this code is literally useless because bots can't use slash commands but I think anyone reading this gets the point.
        checks("User is a bot.") { // Note the string saying the user is a bot when the check inverted that boolean.
                                   // The reason for this is that's the string shown to the user when the check FAILS, 
                                   // so therefore it should be text saying why the check returned false.
            !ctx.user().isBot
        }
    }