onReactionAdd

Command executes when a reaction gets added to a message.

Event: onReactionAdd Type: reactionAddCommand

Prerequisites

Add the onReactionAdd Event:

bot.addEvent([
    "onMessage",
    "onInteraction",
    "onReactionAdd" //This is what you need to add
])

Add the GUILD_MESSAGE_REACTIONS Intent:

const dbd = require("dbd.ts")

const bot = new dbd.Bot({
    intents: ["GUILDS", "GUILD_MESSAGES", "GUILD_MESSAGE_REACTIONS"], //You add the intent to this array, as shown
    prefix: "PREFIX"
})
//The rest of your index.js file here

Functions

  • $emojiString - The stringified emoji an user reacted with.

  • $emojiID - The ID of the emoji an user reacted with.

  • $emojiName - The name of the emoji an user reacted with.

  • $emojiIdentifier - The identifier of the emoji an user reacted with.

  • $reactionAuthorID - Returns the user who reacted.

Example

bot.commands.add({
  type: "reactionAddCommand",
  code: `$channelSendMessage[773363417338609674;
**New Reaction**
Emoji ID: $emojiID
Identifier: $emojiIdentifier
Name: $emojiName
String: $emojiString
Author: $userTag[$reactionAuthorID] ($reactionAuthorID)]`
})

You should use server variables in $channelSendMessage[] for 'channelID' (if your bot is in more than 1 server).

Last updated