Skip to content

Permissions

Kaktushose edited this page Jan 23, 2022 · 2 revisions

Permissions

The permissions system is kept quite simple. A certain permission level is described by a String. This can be whatever you want., e.g. a number, a simple name like admin or a domain based system like user.ban. To add a permission level to the framework, you don't have to define it explicitly. Just start to use it when writing commands and the framework will add it automatically. By default, this framework supports the default Discord permissions, such as BAN_MEMBERS.

Add Permissions to a Command

The @Permission annotation is used to define what permissions a command requires in order to be executed. You can either annotate an entire class or just one method. If a class is annotated, then all commands inside this class will require this permission. You can also pass an array to add several permissions.

@Permission("BAN_MEMBERS")
@CommandController
public class BanCommand {

    @Command("ban")
    public void onCommand(CommandEvent event) {

    }

}

The framework will automatically check if the user has the BAN_MEMBERS permission before executing the command.

Important

This wiki is the documentation for V3 (text commands)! If you're using V4 (interactions) please refer to the new documentation

Home

Getting Started

Writing Commands

Advanced Configuration

Util

Clone this wiki locally