[英]Discord.JS | Display Users who have a specific roles
如果我沒看錯,你希望它只有具有特定角色的用戶嗎? 好吧,這里是 go。
client.on("message", msg => {
//<property> can be replaced with role id, to find by id, with role name, to find by name, etc.
var allUsers = [];
msg.guild.members.fetch(); //cache users
msg.guild.members.cache.forEach(m => {
if(m.roles.cache.find(r => r.<property> === "whatever")) allUsers.push(m);
})
})
這樣,數組allUsers
最終將擁有您選擇的角色的所有用戶。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.