emoji react message

how to make it add reactions to the message?
16 Replies
d.js toolkit
d.js toolkit2y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
Zanoriks
ZanoriksOP2y ago
this code, and I want it to simply add reactions to the message sent to the channel
Nixtl
Nixtl2y ago
Most useful thing to send you would be https://old.discordjs.dev/#/docs/discord.js/main/class/Message?scrollTo=react <Message>.react(emoji)
Discord.js
Discord.js is a powerful node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.
Zanoriks
ZanoriksOP2y ago
I know, but where to put it? for it to work
Nixtl
Nixtl2y ago
After you've fetched whatever message you want to add the reaction to. It looks like you're using a button so if you want to reply to the message the button is attached to you can just put interaction.message.react(emoji); in the block you want it to run in. If you want the user message, you'll usually have to fetch it yourself if not available by interaction.message. It's really dependent on what condition you want to send the reaction in.
Zanoriks
ZanoriksOP2y ago
I want it to be in this place
Zanoriks
ZanoriksOP2y ago
I just don't know where to put it in the code code
Nixtl
Nixtl2y ago
In case "opcje": is where your sending that right?
Zanoriks
ZanoriksOP2y ago
yes
Nixtl
Nixtl2y ago
You should be ok changing the line bottom .then() line to
.then(() => setTimeout((_) => {
interaction.message.edit({ components: [new ActionRowBuilder().addComponents([new ButtonBuilder().setCustomId("pomysly-opcje").setStyle("Primary").setEmoji(":shield:")])] });
interaction.message.react(emoji);
}, 5000));
.then(() => setTimeout((_) => {
interaction.message.edit({ components: [new ActionRowBuilder().addComponents([new ButtonBuilder().setCustomId("pomysly-opcje").setStyle("Primary").setEmoji(":shield:")])] });
interaction.message.react(emoji);
}, 5000));
Can compact it back to one line if you want, I multi-lined it so you can see what I did. Just change emoji to the emoji
Zanoriks
ZanoriksOP2y ago
can i use 2 times interaction.message.react(emoji)?
Nixtl
Nixtl2y ago
Yep
Zanoriks
ZanoriksOP2y ago
the emoji is only added when the button is clicked
Nixtl
Nixtl2y ago
Let me clarify... You want to add emojis to any message send in a channel? Are you making a suggestion channel using a modal to get the title and description? If yes to both of these then yeah this isn't gonna work on a button interaction, you have to do the samething in the model interaction after the message is sent.
Zanoriks
ZanoriksOP2y ago
I will try to do it tomorrow, and if anything, I will let know here. Hah
Want results from more Discord servers?
Add your server