DiSky DiSky 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 emote value. 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 emote value reacts with that custom emote 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

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

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.