Moderation
checkUserPerms
$checkUserPerms
The $checkUserPerms function checks if a user has all the specified Discord permissions. This is a direct alias of $hasPerms — the two functions are strictly identical.
Syntax
$checkUserPerms[userID;permission1;permission2;...]
Parameters
| Parameter | Type | Description |
|---|---|---|
userID |
Snowflake | The ID of the user to check. |
permission1;permission2;... |
String[] | Required permissions (checks with AND). |
Return value
- Type: String
"true"or"false" "true": The user has all permissions."false": At least one permission is missing.
Behavior
- Inline check: Does not interrupt the command.
- AND check: All listed permissions are required.
Administrator(and server ownership) covers all permissions.- Permissions are read at the server level (roles); channel overwrites are not applied. A member currently timed out only keeps
View ChannelandRead Message History.
Examples
Inline verification
$if[$checkUserPerms[$authorID;KickMembers]==true]
$kick[$mentioned[1]]
$else
$sendMessage[❌ KickMembers permission required.]
$endif
Checking another user’s permissions
$if[$checkUserPerms[$mentioned[1];Administrator]==true]
$sendMessage[⚠️ You cannot perform this action on an administrator.]
$stop
$endif
$ban[Moderation]
Multi-permissions
$if[$checkUserPerms[$authorID;ManageMessages;ReadMessageHistory]==true]
$clear[50]
$else
$sendMessage[❌ Insufficient permissions.]
$endif
Notes
$checkUserPermsand$hasPermsare interchangeable (the engine registers identical handlers;$checkUsersPermsis a third identical name). Use whichever syntax is most explicit for your context.- For the bot itself, pass
$botIDas theuserID. - For a check with automatic interruption (guard), use
$onlyPerms. - Permission names are case-insensitive and ignore non-alphanumeric characters (
BanMembers,ManageMessages,Administrator, etc.). Short aliases such asAdmin,BanorKickare accepted. An unknown name raises the errorInvalid permission. userIDmust be a positive numeric ID, otherwise the function raisesInvalid user ID.- The server owner and members with
Administratoralways get"true".
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.