Moderation
emojiExists
$emojiExists
The $emojiExists function checks if a custom emoji exists, from its ID (not its name).
Syntax
$emojiExists[emojiID]
Parameters
| Parameter | Description |
|---|---|
emojiID |
The numeric ID of the emoji (the digits in <:name:ID>). |
Return value
- Type: String (boolean)
trueif an emoji with this ID is found.falseif no emoji with this ID is found, or ifemojiIDis not a positive number (a name such ascoolalways givesfalse).
Behavior
- The emojis of the current server are searched first, then those of the other servers the bot is in.
- Never raises an error for an invalid ID: it returns
false. - To look an emoji up by name, use
$customEmoji[name](it returns the emoji markup, or an empty string).
Examples
Before deletion
$if[$emojiExists[$message[1]]==true]
$removeEmoji[$message[1]]
$sendMessage[✅ Emoji **$message[1]** deleted.]
$else
$sendMessage[❌ No emoji has the ID **$message[1]**.]
$endif
Check by name with $customEmoji
$if[$customEmoji[$message]!=]
✅ The emoji **$message** is available: $customEmoji[$message]
$else
❌ The emoji **$message** does not exist.
$endif
Notes
- The argument is an ID. Passing a name returns
false. - To create an emoji, see
$addEmoji[name;url;returnEmoji].
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.