【问题标题】:Discord.js awaitReactionsDiscord.js 等待反应
【发布时间】:2021-12-30 03:34:28
【问题描述】:
const filter = (reaction, user) => {
  return (
    ["1️⃣", "2️⃣", "3️⃣", "4️⃣", "5️⃣", "6️⃣"].includes(reaction.emoji.name) &&
    user.id === msg.author.id
  );
};

message
  .awaitReactions({ filter, max: 1, time: 30000, errors: ["time"] })
  .then(async function (collected) {
    const reaction = collected.first();

    console.log(reaction.emoji.name);

    if (reaction.emoji.name === "1️⃣") {
      message.delete();

      msg.reply("Done");
    }
  })
  .catch((collected) => {
    message.delete();
    msg.reply("No response given.");
  });

我上面的代码不工作并且永远不会触发,我不知道为什么我在谷歌上查找,他们都给出了这个代码。感谢任何帮助。

【问题讨论】:

  • 你的 Discord.js 版本是多少?
  • ^13.3.1 是我的不和谐版本
  • 你有GUILD_MESSAGE_REACTIONS的意图吗?

标签: javascript node.js discord discord.js


【解决方案1】:

问题是我忘记使用 GUILD_MESSAGE_REACTIONS 意图。我的坏。

【讨论】:

    猜你喜欢
    • 2021-01-27
    • 2021-08-12
    • 2020-12-03
    • 2021-03-07
    • 2020-07-02
    • 2020-11-21
    • 2020-12-05
    • 2020-10-16
    • 2019-10-21
    相关资源
    最近更新 更多