【发布时间】:2021-05-20 13:12:51
【问题描述】:
Bot 如果点击反应的 User 具有 ROLE "ID"
我决定试试这个,但没有成功
if(message.member.roles.cache.has(role.id)) {
console.log(`Yay, the author of the message has the role!`);
} else {
console.log(`Nope, noppers, nadda.`);
}
====这里是主要代码====
sentMessage.react("✅");
message.delete({ timeout: 100 });
const filter = (reaction, user) => {
return !user.bot && ["✅"].includes(reaction.emoji.name);
};
sentMessage
.awaitReactions(filter, {
max: 1,
time: 60000,
})
.then((collected) => {
const reaction = collected.first();
if (reaction.emoji.name === "✅") {
const member = reaction.users.cache.find((user) => !user.bot);
message.author.send(Hello)
【问题讨论】:
-
什么是
sentMessage? -
对消息做出反应
-
sentMessage是如何定义的?
标签: javascript discord discord.js