Custom Command
FunctionsRole Functions

$roleCount

The $roleCount function returns the total number of roles present in your Discord server (guild).

Usage

$roleCount

This function is straightforward to use. Simply include it in your command response to display the role count.

Example:

Let's create a custom command that announces the total number of roles in the server.

Member
9/5/2026
!!exec There are $roleCount roles in the server!
Custom Command
APP
9/5/2026
There are 23 roles in the server

In this example:

  • The user triggers the custom command with !!exec.
  • The command uses $roleCount to retrieve the role count.
  • The bot responds with a message stating, "There are 23 roles in the server" (the number will reflect the actual role count of the server).

Function Difficulty: Easy

Tags: Role Count Amount Of Roles Return Number

On this page