DiSky Atlas v5.0.0-b1

Reactions

guide

React to a message, remove a reaction, and read the reactions Discord tracks on it.

messagesreactions

This page covers adding a reaction to a message, removing one, the events that fire when a user reacts, and reading the reactions already on a message. You're assumed to have a bot named "my-bot" logged in and to know how to send a message.

How reactions work

adds one or more reactions to a message, as the bot. It takes a list of unicode emojis, custom emote values, or both mixed together.

on message received seen by "my-bot":
    if discord content of event-message is "!react":
        react to event-message with "✅"

Each entry in the list is either a text or an emoji value (an emote is one too). A text is read as a unicode emoji character, or as the formatted <:name:id> (or <a:name:id> for an animated one) form of a custom emote; an emoji or emote value reacts with that emoji directly, and is the safer choice since it never depends on getting the formatted text right. Get one from emojis of a guild (cached) or mentioned emotes of a message; await set it from emotes of a guild when you need the fresh list (see cache and await).

on message received seen by "my-bot":
    if discord content of event-message is "!react-emote":
        set {_emote} to first element of (emojis of event-guild)
        react to event-message with {_emote}
        react to event-message with ("👍" and {_emote})
effect reactMessagereact to [the] [message] %message% with [the] %emojis/strings%Adds one or more reactions to a message, as the bot.since 5.0.0-a1

Emojis by name

(also written emote or reaction) turns a name into an emoji, so you never paste the character itself. It takes the Discord shortcode, with or without colons, the same one you type in the Discord client.

on message received seen by "my-bot":
    if discord content of event-message is "!react-name":
        react to event-message with emoji "joy"
        react to event-message with reactions ("sparkles" and ":thumbsup_tone2:")
        react to event-message with emote "disky" in event-guild

Each text is read in this order: a custom emoji id or its <:name:id> form, a unicode character, then a name. With in %guild%, a name first looks for a custom emoji of that guild (case-insensitive), then for a shortcode; without a guild, the shortcode comes first, then the custom emojis any logged-in bot can see. With await, an id or a name missing from the cache is also looked up on Discord (the guild's emojis, or the bot's application emojis without a guild). A text that matches nothing is a readable error in the console, and the other texts of the list are still returned.

Its result is an emoji, not an emote: react to accepts it, but suppress does not, even for a custom emoji found by name.

expression EmojiCore · Expressions[the] (emoji|emote|reaction)[s] %strings% [(in|from) [the] [guild] %-guild%]An emoji from its name, its unicode character or the id of a custom one (an emote). Several texts give several emojis.list of Emojisince 5.0.0-b1

Removing reactions

removes a reaction from a message: named alone it removes the bot's own reaction, named with a user it removes that user's.

on message received seen by "my-bot":
    if discord content of event-message is "!unreact":
        set {_emote} to first element of (emojis of event-guild)
        suppress {_emote} from event-message
        suppress {_emote} of event-user from event-message
Only a custom emote value works here

suppress takes an emote value, not a text: there is no way to hand it a raw unicode emoji like "✅". Get the emote from emojis of the guild or mentioned emotes of the message, as above. There is also no effect to clear every reaction from a message at once in v5; suppress always targets one emote (and optionally one user) per line.

effect suppress reactionsEmotesuppress [the] %emotes% [(of|from) [the] %-user%] (of|from) [the] %message%Removes one or more reactions from a message.since 5.0.0-a1

Reaction events

and fire per reaction; on reaction remove all fires once when every reaction is cleared from a message at once. reaction message is fetched from Discord before the trigger starts, so it never needs await (see cache and await).

Event

Values

on reaction add

event-channel, event-guild, event-member, event-user, reaction message

on reaction remove

event-channel, event-guild, event-member, event-user, reaction message

on reaction remove all

event-channel, event-guild, reaction message

on reaction add seen by "my-bot":
    send "%event-user% reacted to '%discord content of reaction message%'" to console

v5 has no Emote type for the reaction itself yet, so none of the three events tell you which emoji was added or removed; only who reacted, and on which message.

event Reaction AddEvents(reaction|emote)[s] add[ed]Fired when a message, that can be seen by the bot, receive a reaction. This will be fired, by default, both guild & private messages, use the 'event is from guild' condition to avoid confusion.since 5.0.0-a1

Reading reactions

a message returns one element per distinct emoji reacted with. None of its properties are exposed in v5 (not even the emoji or the count), so the list is only useful for its size.

on message received seen by "my-bot":
    if discord content of event-message is "!reaction-count":
        reply with "%size of reactions of event-message% distinct reaction(s)"

Errors you may see

Message (console)

Cause

Fix

[10014] Unknown Emoji

react to was given a custom emote that no longer exists, or an unformatted custom emote id

Use a fresh emote value from emojis of/mentioned emotes of, not a hand-written id

[50013] Missing Permissions

The bot's role lacks Add Reactions in that channel

Grant Add Reactions to the bot's role

IllegalArgumentException: no emoji matches '<text>'

emoji was given a text that is no unicode emoji, no Discord shortcode and no custom emoji name the bot can see

Check the shortcode in the Discord client, or add in event-guild for a custom emoji of that guild

Was this page helpful?
An unhandled error has occurred. Reload 🗙

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.