如何获取机器人发送的嵌入的反应收集器

How to get reaction collector on embed sent by the bot

我正在使用类似的东西,但我希望它在发送的嵌入中寻找反应!不在消息中

const collector = message.createReactionCollector((reaction, user) => 
    user.id === message.author.id &&
    reaction.emoji.name === "◀" ||
    reaction.emoji.name === "▶" ||
    reaction.emoji.name === "❌"
).once("collect", reaction => {
    const chosen = reaction.emoji.name;
    if(chosen === "◀"){
        // Prev page
    }else if(chosen === "▶"){
        // Next page
    }else{
        // Stop navigating pages
    }
    collector.stop();
});

RichEmbed 作为消息的一部分发送。因此,当您添加反应时,它是在消息中,而不是嵌入中。

请参阅下面的示例,其中给出了嵌入反应的外观

const { RichEmbed } = require('discord.js');

var embed = new RichEmbed()
  .setTitle('**Test**')
  .setDescription('React with the emojis.');

message.channel.send(embed)
  .then(async msg => {
    // Establish reaction collector

    for (emoji of ['◀', '▶', '❌']) await msg.react(emoji);
  })
  .catch(console.error);