Entity Info
roleCount
$roleCount
The function $roleCount returns the total number of roles present on the Discord server, including the @everyone role.
Syntax
$roleCount
The function takes no argument.
Parameters
This function takes no parameter; it always counts the roles of the current server.
Return Value
| Type | Description |
|---|---|
integer |
The number of roles on the server. |
Examples
Number of roles
$sendMessage[This server has $roleCount roles.]
Server statistics
$sendMessage[
**Server Stats:**
Members: $memberCount
Roles: $roleCount
Channels: $channelCount
]
Check role limit
$if[$roleCount>=250]
$sendMessage[⚠️ Warning: This server has a lot of roles.]
$endif
Notes
- Includes the
@everyonerole in the count. - The roles are listed from Discord for the current server (
guild.id).
Try it
Paste an example into the playground to preview its message (functions that act on Discord are not run), or build the same thing with blocks.