'How to add reactions to a message in discord?

I'm trying to add emoji reactions, either from a server or from discord itself

Hi, I'm trying to get my bot to react to the emojis I give it and I'm having a problem with that, which is that it doesn't add the reactions that aren't from a server. How can I make it react no matter if it's a custom emoji from a server or from discord itself? I leave what I have tried so far.

const mensaje = await message; const msg = await message.channel.messages.fetch(msg1.reference.messageId); const emojis = args.slice(0).join(" ").split("-");

for (let i = 0; i < emojis.length; i++) { const element = emojis[i]; await msg.react(element) } setTimeout(() => message.delete(), 2000)


Solution 1:[1]

After sending your main message that you wanted to add emoji, you need to use then after the message

message.channel.send({content: "your_message_here"}).then((msg) => {
   msg.react("your_emoji_here")
   msg.react("your_emoji_here")
});

You can use this too in every type of sending messages such us .reply or into embed

//message.reply
message.reply({content: "your_message_here"}).then((msg) => {
   msg.react("your_emoji_here")
   msg.react("your_emoji_here")
});

//embed
message.channel.send({embeds: [embed_name]}).then((msg) => {
   msg.react("your_emoji_here")
   msg.react("your_emoji_here")
});

//message.reply embed
message.reply({embeds: [embed_name]}).then((msg) => {
   msg.react("your_emoji_here")
   msg.react("your_emoji_here")
});

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 æ–°Acesyyy