Entity Info
isBot
$isBot
The function $isBot allows you to know if a user (by default the one who triggered the command) is a bot account or a normal user account.
Syntax
$isBot[(User ID)]
Parameters
| Parameter | Description |
|---|---|
User ID |
Optional. The user to check. If omitted or empty ($isBot, $isBot[]), the command author is checked. A non-numeric or non-positive value raises Invalid user ID.; an unknown user raises User not found. |
Return Value
- Type: String
"true"or"false" "true": The account is a bot."false": The account is a normal user.- Without an ID, an empty string if the host supplied neither the
author.isBotnor theuser.isBotcontext variable.
Behavior
- Without an ID, the engine does not query Discord: it returns the text of the
author.isBotcontext variable, or else ofuser.isBot, as supplied by the host. Whether webhooks count as bots depends on the host. - With an ID, the user is looked up through Discord.
Examples
Simple detection
$if[$isBot==true]
$sendMessage[🤖 Detection: you are a bot!]
$else
$sendMessage[👤 You are a human user.]
$endif
Check another user
$if[$isBot[$mentioned[1]]==true]
$sendMessage[That user is a bot.]
$endif
Ignore bots
$if[$isBot==true]
$stop
$endif
$sendMessage[Welcome $userName!]
Conditional logging
$if[$isBot==true]
$log[Command executed by the bot $userName (ID: $userID)]
$else
$log[Command executed by the user $userName (ID: $userID)]
$endif
Notes
- Very useful for preventing bots from executing certain commands (anti-looping).
- Typically used with
$stopto silently ignore executions triggered by other bots. - Comparisons with
==are case-sensitive: compare with lowercasetrue.
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.