DISCORD.JS在等待反应方面有问题

DISCORD.JS在等待反应方面有问题,discord.js,Discord.js,因此,基本上,我希望机器人在用户对消息做出特定表情反应后删除其消息。当我尝试使用下面的代码时,什么都没有发生。从来没有错误。我也不想要时间限制,只要有一个反应就做一件事。当前代码: return ['what does your filter look like? We con't see the first line of it. Your problem is that you try to check the emote twice. Once in the filter and

因此,基本上,我希望机器人在用户对消息做出特定表情反应后删除其消息。当我尝试使用下面的代码时,什么都没有发生。从来没有错误。我也不想要时间限制,只要有一个反应就做一件事。当前代码:

    return ['what does your filter look like? We con't see the first line of it. Your problem is that you try to check the emote twice. Once in the filter and then again in the function. Only use the filter here, or use the function if you want multiple emotes (i wouldn't recommend it).

my solution would look like this:

var message = msg.channel.send("test message");
    const filter = (reaction, user) => reaction.emoji.name === ':ok_hand:' //whatever emote you want to use, beware that .await.Reactions can only check a singel emote
    message.then(m=>{m.awaitReactions(filter, { max: 1})
        .then(collected => {
            console.log("do what ever");
            m.delete();//such as this
        })
        .catch(console.error);
     });

return['您的筛选器是什么样子的?我们看不到它的第一行。您的问题是,您尝试检查了两次表情。一次在筛选器中,然后再次在函数中。仅在此处使用筛选器,或者如果您想要多个表情,请使用该函数(我不推荐)

我的解决方案如下所示:

这对我来说很有用。请记住,#waitingreactions并不是万能的。如果你想要多种与消息交互的方式,你可能想看看#createReactionCollector,它的工作方式相同,但在每次emote更改时都会触发

我希望我能帮忙