$usersWithRole
This function retrieves a list of users who have a specific role within your Discord server. The information is pulled directly from the bot's cache.
Usage
$usersWithRole[roleID;separator (optional, default: newline);id/username/tag/mention (optional, default: tag)]
Parameters:
roleID
: The ID of the role you want to filter users by.separator
(Optional): The character(s) used to separate the list of users. Defaults to a newline character (\n
).id/username/tag/mention
(Optional): Specifies what information about each user to return. Defaults totag
(username#discriminator).id
: Returns the user's ID.username
: Returns the user's username.tag
: Returns the user's full Discord tag (username#discriminator).mention
: Returns a mention of the user (e.g.,<@1234567890>
).
Examples
Example 1: Get usernames of users with the "Members" role, separated by commas.
!!exec $usersWithRole[Members;, ,username]
Example 2: Get tags of users with no specific role (provide empty role ID), separated by commas and a space.
!!exec users with no roles: $usersWithRole[;, ,tag]
Warning
Important: This function relies on the bot's cache. If the cache is not fully populated (especially on larger servers or if the bot has recently started), the results may be incomplete or inaccurate. Ensuring all guild members are cached is best achieved at tier 5.