PermissionOverwrites question.
I want to deny viewing access for a specific channel (that already has specific viewing permissions (for set to it) to everyone, but also be able to easily revert them. What should I pay attention to to avoid possibly overwriting permissions for that channel?
I know I need the PermissionOverwrites to do this to set a deny on everyone, but if I then set an allow later, does that overwrite the existing permissions?
12 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅
Marked as resolved by OPDiscord.js 14.15.3 (as in tag)
Node v20.12.0
A couple hours ago I asked this to chat gpt and it got me this:
It's different when the permissions is set at the time the channel is created, but you probably knows this better than me. I had to ask gpt
I also don't know if there is .add or .remove IG there is
discord.js
discord.js
discord.js is a powerful Node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.
Nvm
?
You could check the docs or try asking chat gpt, this should be an easy thing
I have checked the docs, I am asking about something that is in the Docs, about PermissionOverwrites
I'm not asking ChatGPT about code. I'm asking someone that has actually used discord.js to help explain what I'm trying to do.
I also initially wrote something like this after some research, but I want to avoid making mistakes like overwriting existing permissions, I couldn't find anything specific about it.
PermissionOverwriteManager#edit
will only change the selected member/role's overwrite to what you specify. using set
will essentially remove all overwrites and then set it to what you provide
if you're talking about adding or removing a permission from an existing overwrite, then you would get the current overwrite and modify that, then pass it to editAhh, thank you. That's a good thing to keep in mind. I appreciate it 🙂
Yeah was gonna say that
Thanks, chatgpt 👍
I'll go with a get, change and edit, in that case. Appreciate the explanation!