$hasAnyRole

This function checks if a user has at least one of the specified roles. You can check the message author's roles or specify a different user ID.

Usage

$hasAnyRole[roleID1;roleID2;...]
$hasAnyRole[userID;roleID1;roleID2;...]

Parameters:

  • roleID1;roleID2;...: A semicolon-separated list of role IDs to check for.
  • userID (Optional): The ID of the user to check. If omitted, the message author's ID is used.

Examples

Example 1: Checking if the message author has the "Admin" role:

In this example, we use $onlyIf to prevent the command from executing if the author does not have the "Admin" role. Replace "Admin" with the actual ID of your Admin role.

Admin04/04/2025
!!exec $onlyIf[$hasAnyRole[$authorID;Admin]==true;You are not admin]
You are admin!

Custom Command Bot 04/04/2025
You are admin!

Example 2: Checking if a normal user (without the "Admin" role) attempts the same command:

Normal User04/04/2025
!!exec $onlyIf[$hasAnyRole[$authorID;Admin]==true;You are not admin]
You are admin!

Custom Command Bot 04/04/2025
You are not admin