[英]How do you iterate/get ever role ID from a user?
我想遍歷單個用戶的整個角色 ID 列表,並查看該用戶是否具有我擁有的文件中的角色 ID 之一。 就在“AccessListR.includes()”處,我不知道該放什么,因為用戶角色 ID 列表應該是 go 或類似的東西。 我想我需要一個 function 來遍歷它們並每次將它們返回給 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.")
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.