Channel Permissions
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
8 Replies
• 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.
the log shows all channels , even if the Srole is not included
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.
Instead of checking for the role's perms with
channel.permissionsFor()
, try checking channel.permissionOverwrites.cache.has(...)
thanks for your response , i appreciate it , also is it possible to get permission for that role? imma guess smth , i might be able to use to get the permissions?
Yep! And just checking if that's undefined or not can also tell you if there's the overwrite or not
thats a huge help , thanks a lot 🙂
i was lost in the docs 😄
seems like .has is smth i guess
TypeError: Cannot read properties of undefined (reading 'cache')
[object Promise]
Can you share your code?
https://sourceb.in/0xM2Sx8fjH
i also used
in case it wants the channel id. but still the same
tried changing the code in some othe ways but still the same , idk whyy thou -_-
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?
Yeah so the code i shared i used 'sRole' and got that error and then i used 'sRole.id' which returned the same thing.
Kk i was using the crash handler ill send full errro in a second
turned out it working
( i did use id first time it didnt work )
i might have made a mistake but it worked and i got the channels that got that role +
permission which are allowed and denied as bit numbers