为什么给我这个错误?如何定义表情符号? IT人员应该只检查反应是否与该表情符号有关。
.then(function (message, reaction) {
message.react("?")
message.react("?")
const filter = (reaction, user) => {
return ['?', 'B'].includes(reaction.emoji.name) && user.id === message.author.id;
};
message.awaitReactions(filter, { max: 1 })
.then(collected => {
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>.');
}
})
});
答案 0 :(得分:1)
reaction
。从回调函数中删除参数。然后,要访问应用的反应,您需要从Message#awaitReactions()
返回的Collection中读取它。例如...
.then(collected => {
const reaction = collected.first();
// now you can check the reaction with the code you were using
})