【发布时间】:2020-08-02 03:47:02
【问题描述】:
所以我的机器人现在在第一条消息之后立即发送“A”反应消息,但用户没有反应。它不应该那样做。为什么?我没有错误。
client.on("guildMemberAdd", member => {
try {
member.send(`Hello ${member}, welcome to the PotatoHost Server!
I want to help you and so my question is: Do you want to buy a server or do you need more informations first? \n
A: I want to buy a server
B: I need more informations first \n
Please react to this message with A or B.`)
.then(function (message) {
message.react("????")
message.react("????")
const filter = (reaction, user) => {
return ['????', 'B'].includes(reaction.emoji.name) && user.id === message.author.id;
};
message.awaitReactions(filter, { max: 1, time: 3600000, errors: ['time'] })
.then(collected => {
const reaction = collected.first();
if (reaction.emoji.name === '????') {
message.channel.send('Ok, so you want to buy a server. Let me recommend you to visit <#699374469977735208>.');
}
else {
message.channel.send('Ok, so you need more informations first. Let me recommend you to visit <#699374469977735208>.');
}
})
.catch(collected => {
message.channel.send('You reacted with neither A or B.');
})
});
}catch (err) {
console.log(err)
}
})
【问题讨论】:
标签: javascript reactjs bots discord.js message