#Channel Permissions

19 messages · Page 1 of 1 (latest)

drowsy hill
#

hey im trying to get a specific role permission in a channel and copy its perms with another role
in another word duplicatiing the role permission in the same channel.

for example i got a role named Verified with set of permissions in some channels , and i wanna add another role named Verifed 2 to those channels which has verified role in them and copying its perm.

this is what ive done so far but im stuck at where i should get channels where they only have Verified role perm

gilded solarBOT
#

• 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.

drowsy hill
#
const role = interaction.options.getRole('role');
        const sRole = interaction.options.getRole('s_role');

        await interaction.deferReply({ ephemeral: false });
        const embed = new EmbedBuilder().setColor('Green').setTimestamp();
        let count = 0;
        embed.setTitle('💻Processing Your Command');
        await interaction.editReply({ embeds: [embed] });

        interaction.guild.channels.cache.forEach((channel) => {
            if (channel.permissionsFor(sRole)) {
                console.log(
                    `Channel Name: ${
                        channel.name
                    } \n Permissions : ${channel.permissionsFor(sRole)}`
                );

                //channel.permissionOverwrites.delete(sRole.id);
                //channel.permissionOverwrites.set
            }
        });
#

the log shows all channels , even if the Srole is not included

drowsy hill
#

additional note : my main problem is how should i filter the channels that has only a specific role in their permission list , then how do i get those permission of that role.

twilit pulsar
drowsy hill
twilit pulsar
#

Yep! And just checking if that's undefined or not can also tell you if there's the overwrite or not

drowsy hill
drowsy hill
twilit pulsar
#

Can you share your code?

drowsy hill
drowsy hill
#

cant get a straight thing about it in docs also

#

So i was checkinh docs again
I found out permissionoverwrites doesnt directly have .cache.get thing.
But it will return permissionoverwritemanager
Which has those properties.

But how am i going to get that in return?

void pewter
void pewter
drowsy hill
drowsy hill