gpt4 book ai didi

node.js - (discord.js) 如何提及对机器人消息使用react的用户?

转载 作者:行者123 更新时间:2023-12-04 07:51:12 25 4
gpt4 key购买 nike

我如何提及对我的机器人消息使用react的用户?我想发送诸如“@user 对我的消息使用react!”之类的消息,这是我的代码:

msg.awaitReactions((reaction, user) => user.id == user.id && (reaction.emoji.name == '👍'), { max: 1, time: 30000 }).then(collected => {
if (collected.first().emoji.name == '👍') {
//here I want to send the message with the mention
} else {
//I added it for case that I going to use yes or no react question
}
}).catch(() => {
//maybe I will add here message that says the time passed.
});

最佳答案

阅读文章和故障排除后,我想出了以下解决方案:

    msg.awaitReactions((reaction, user) => user.id == user.id && (reaction.emoji.name == '👍'),
{ max: 1, time: 30000 }).then(collected => {
const reaction = collected.first();
if (collected.first().emoji.name == '👍') {
const member = reaction.users.cache.find((user) => !user.bot);
message.channel.send(`test is ${member}`)
} else {
//I added it for case that I gonna use yes or no react question
}
}).catch(() => {
//maybe I will add here message that says the time passed.
});

关于node.js - (discord.js) 如何提及对机器人消息使用react的用户?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66969238/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com