cmd.message.addReactions
Adds one or more reactions to a message. Reactions are applied in order, one at a time.
JavaScript
const { cmd } = require("syntx.js");
await cmd.message.addReactions({ channel, messageID, reactions }, message);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
channel | string | Yes | ID of the channel that contains the target message. |
messageID | string | Yes | ID of the message to react to. |
reactions | string[] | Yes | Array of emojis to add. Must contain at least one entry. |
message | discord.js Message | Interaction | Yes | The message or interaction context. |
Emoji formats
Both standard Unicode emojis and custom guild emojis are supported:
- Unicode emoji:
"👍" - Custom emoji:
"<:name:id>"or"<a:name:id>"for animated
Returns
The discord.js Message object that was reacted to.
Example
JavaScript
client.command({
name: "react",
content: async (message) => {
await cmd.message.addReactions(
{
channel: message.channel.id,
messageID: message.id,
reactions: ["👍", "👎", "<:custom:123456789>"],
},
message
);
},
});Warning
The bot must have the Add Reactions permission in the target channel. If any emoji in the array is invalid or the permission is missing, a SyntxError is thrown.
Note
Reactions are added sequentially. If one fails, the function throws immediately and any remaining reactions in the array will not be added.