我不明白我该怎么做。
我当前的代码是:
let server = Bot.guilds.cache.get('816022730926456852')
var memberRole = server.roles.cache.find(role => role.name === "access")
let member = server.members.cache.get(msg.author.id)
if (!member.roles.has(memberRole)) {
return
}
答案 0 :(得分:0)
如果您的意思是检查特定服务器中的用户角色。你会这样做:
let server = bot.guilds.cache.get("guild id");
let memberRole = message.member.roles.cache.some(
(role) => role.name === "RoleName"
);
let member = server.members.cache.get(message.author.id);
if (!member.roles.has(memberRole)) {
return;
}
应该可以:)