Skip to content Skip to sidebar Skip to footer

Discord.js Setting Permission On Channel To "/" (neutral)

I am looking to set user permissions on a text channel to neutral/null/'/' but overwritePermissions() seems to only use allow and deny currently, a past post I saw showed setting t

Solution 1:

I believe what you are looking for is Channel#updateOverwrites() which, as well as having a different function to overwritePermissions(), also has a different format.

overwritePermissions overwrites all the permissions in a channel (as suggested by its name). So even if you only want to change one thing, overwritePermissions will bring everything with it. Thankfully, we also have updateOverwrites. This method will only change permissions for one member/role.

Here's how you could use it:

// as a note, `forEach()` automatically coverts the collection to an array,// so no need for the `array()` function
member.guild.channels.cache.forEach((channel) => {
 channel.updateOverwrite(member, { // update permissions only for the memberVIEW_CHANNEL: null, // set view_channel to default
 });
});

Post a Comment for "Discord.js Setting Permission On Channel To "/" (neutral)"