Entity Info
isAdmin
$isAdmin
The function $isAdmin[userID] returns "true" if the given user has the Administrator permission on the Discord server.
Syntax
$isAdmin[userID]
Parameters
| Parameter | Description |
|---|---|
userID |
Required. The Discord ID of the user to check. An invalid ID raises an error (“Invalid Discord ID.”). |
Return Value
- Type: String
"true"or"false" "true": The user has theAdministratorpermission."false": The user does not have this permission.
Behavior
$isAdmintakes one argument, the user ID; a bare$isAdminis invalid.- The
Administratorpermission grants all permissions on the server. - The server owner is implicitly an administrator (returns
"true"). - The permissions of the user are the union of the permissions of their roles (including
@everyone); a user who is not a member of the server makes the Discord lookup fail with an error instead of returning"false".
Examples
Restricting a command
$if[$isAdmin[$authorID]==true]
$ban[Moderation]
$sendMessage[<@$mentioned[1]> was banned.]
$else
$sendMessage[Only administrators can use this command.]
$endif
Displaying an admin menu
$if[$isAdmin[$authorID]==true]
$title[Administration Panel]
$description[
**Available commands:**
`/ban`, `/kick`, `/mute`, `/config`
]
$color[#ED4245]
$endif
Logging admin actions
$if[$isAdmin[$authorID]==true]
$log[Admin action performed by $userName (ID: $userID)]
$endif
Notes
$isAdminonly checks for theAdministratorpermission, not other individual permissions.- To check for a specific permission (e.g.,
BanMembers,ManageMessages), use$userPerms[userID;amount;separator]and test the result for the permission name.
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.