If I am reading this correctly, you want it to only have users that have a specific role? Well, here you 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);
})
})
With this, the array allUsers
will end up having all the users with the role you chose.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.