Skip to content Skip to sidebar Skip to footer

Discord Js - How To React Multiple Times To The Same Embed?

I've only gotten the first 'moneybag' emoji to react to the newest message in the channel, which is the embed that the bot sends, however, I want the bot to react to the new embed

Solution 1:

Message#react returns a MessageReaction in a promise so you need to do:

message.channel.send(embed)
    .then(m => m.react('💰'))
    .then(m => m.message.react('🎟'))

or

message.channel.send(embed)
    .then(m => {
        m.react('💰')
        m.react('🎟')
     });

or with async await:

const m = await message.channel.send(embed);
await m.react('💰')
await m.react('🎟')

Solution 2:

the first .then() actually returns a MessageReaction object, which is why you're getting this error (can't call .react() on a MessageReaction).

You could 1. Use async/wait

asyncfunction() {
const embed = await message.channel.send('test')
await embed.react('💰')
await embed.react('🎟')
}

or 2. Use the message property of MessageReaction

message.channel.send(embed)
    .then(m => m.react('💰'))
    .then(r => r.message.react('🎟'))

Post a Comment for "Discord Js - How To React Multiple Times To The Same Embed?"