如何从用户那里迭代/获取角色ID



我想遍历单个用户的整个角色ID列表,看看该用户在我的文件中是否有一个角色ID。就在";AccessListR.includes(("是我不知道该放什么的地方,因为这是用户角色ID列表应该放的地方或类似的地方。我想我需要一个函数来遍历它们,并每次将它们返回到if语句。除了我不知道如何从用户那里访问角色列表。这是我的代码:

if ((AccessListBot.includes(message.author.username) || AccessListBotR.includes()) && message.content.includes(prefix)){
message.channel.send("ERROR: You have been blacklisted from using this bot.")

}

您可以使用Collection.some()检查其中一个角色是否返回true:

if ((AccessListBot.includes(message.author.username) || (message.member.roles.cache.some((role) => AccessListBotR.includes(role.id))) && message.content.includes(prefix)){
message.channel.send("ERROR: You have been blacklisted from using this bot.")
}

最新更新