#help regarding guild member permissions and channel permission overwrites

3 messages · Page 1 of 1 (latest)

hearty ledge
#

Hi, I'm trying to make an array of all members in a server who have a certain permission, in this case "KICK" :

mods = [];
members = interaction.guild.members.cache;
console.log(members.permissions);
await Object.keys(members).forEach((member) => {
  if (member.permissions.has("2")) {
    console.log("condition true");
    mods.push(member.id);
  } else console.log("condition false");
});```
```member.permissions``` is undefined, so how do I get the permission of every member?

Second question: If i wanna create a channel and set the permission "VIEW_CHANNEL" of a number of members to "allow" or "deny", then will putting array of all the user IDs as the value for "id" key work ?
```permission_overwrites: [{ id: mods, type: 1, allow: 400 }] //mods is the array```
vapid plank
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

proud plaza
#

guild.members.cache is a collection of all of the members. Idk if Object.keys() works for a collection but if it does then it would return all of the ids in the cache…