$hasAnyRole

Checks if a user has one of the given roles. Returns true or false.

Usage

$hasAnyRole[userID;roleID1;roleID2;...]
  1. userID - (Optional) default value: $authorID. If not included or left empty, $authorID will be used.
  2. role N - You can add as many roles as needed.

Example

Using $hasAnyRole

How to use $hasAnyRole without user argument. Keep in mind that if the user does have only one of listed roles, true will be returned.

User04/23/2025
!!exec I have Admin OR Manager role: $hasAnyRole[admin;manager]
Custom Command Bot 04/23/2025
I have Admin OR Manager role: true
User04/23/2025
!!exec I have Admin role: $hasAnyRole[admin], I have Manager role: $hasAnyRole[manager]
Custom Command Bot 04/23/2025
I have Admin role: true, I have Manager role: false

Suggestion

To make code stop if the user doesn't have the needed role, you can check out $onlyIf. For multiple actions, check $if.

Function difficulty: Easy
Tags: roles management