Skip to content
Entity Info userPerms

$userPerms

The $userPerms function returns the list of permissions of a user on the server, obtained by combining the permissions of all their roles (including @everyone). Channel overrides are not taken into account.

Syntax

$userPerms[userID;amount;separator]

Parameters

Parameter Description
userID Required - The ID of the member. An invalid ID raises an error.
amount Required - Maximum number of permissions to return, or -1 for all. Any other negative or non-numeric value raises an error.
separator Required - The text placed between two permissions (can be empty).

Return Value

  • Type: List of permission names, joined with separator
  • Names are in upper case with underscores, in Discord bit order. Example: ADD_REACTIONS, VIEW_CHANNEL, SEND_MESSAGES, READ_MESSAGE_HISTORY
  • Permissions without a known label are omitted.

Behavior

  • $userPerms requires its 3 arguments: used without argument it is invalid.
  • Returns the permissions resulting from the roles of the member in the current server.
  • ADMINISTRATOR is not expanded into the other permissions.

Examples

Display permissions

$title[Permissions of $userName]
$description[
**Permissions:**
$userPerms[$authorID;-1;, ]
]
$color[#5865F2]
$sendMessage[Permissions]

Restrict a command to moderators

$if[$checkContains[$userPerms[$authorID;-1;,];BAN_MEMBERS]==true]
  $ban[Moderation]
  $sendMessage[<@$mentioned[1]> was banned.]
$else
  $sendMessage[You do not have permission to ban members.]
$endif

Check multiple permissions

$if[$checkContains[$userPerms[$authorID;-1;,];MANAGE_MESSAGES]==true]
  $deleteMessage[$channelID;$messageID]
  $sendMessage[Message deleted.]
$else
  $sendMessage[ManageMessages permission required.]
$endif

Notes

  • Permission names are in English, in UPPER_SNAKE_CASE.
  • For a simple admin check, use $isAdmin.

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.