Skip to content

Permissions

pumbas600 edited this page Jan 3, 2022 · 18 revisions

Halpbot provides support for three different ways of determining if a member has permission to use a command. These three different ways can all be used in conjunction with each other in the @Permissions decorator. These are summarised below:

  1. Using JDA's built-in Permission enum to check the member's permissions.
  2. Defining permission suppliers which verifies if a member has the permission by calling a custom method.
  3. Binding roles to permissions and checking if the member has the necessary roles.

For basic usage of the @Permissions decorator and some examples, refer to the documentation here.

Permission Suppliers

Permission suppliers are methods annotated with @PermissionSupplier that only take in a Guild and Member respectively and return a boolean, defining if the member has the specified permission within that guild. The class these methods are defined in must be annotated with @Service.

NOTE: Permission suppliers will be automatically registered on startup. If they don't match the requirements defined previously, then a warning will be logged into the console and the permission supplier ignored.

Role Binding

Clone this wiki locally