#channel permission change
69 messages · Page 1 of 1 (latest)
- What's your exact discord.js
npm list discord.jsand nodenode -vversion? - Not a discord.js issue? Check out #1081585952654360687.
- 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!
You can’t change the user‘s UI without them interacting with anything, if that’s what you mean
Sorry for my poor English.
I'll explain with an analogy.
there are channels 1, 2, 3, and 4.
At 12 o'clock, channels 1 and 3 will be displayed,
and at 6 o'clock in the evening, channels 2 and 4 will be displayed.
I want to recreate this by having a bot automatically switch everyone's permissions on and off within a channel.
this sounds like a perfect use of a cron job
cron?
set up a cron job to run at the specified times to change the permission overwrites of the channels
Read the package‘s documentation. Not djs related
ok
That's terrible code. I don't know how to write js. Should I just put the ID in guild.id as is?
If you don't know how to write JS, learn how to
and i would advise to learn typescript it has been less painful for me
typescript isnt that good
ReferenceError: "x" is not defined: learn moreTypeError: Cannot read properties of undefined/null (reading "x"): learn more
ok
what version of discordjs do you have
14.15.3
RangeError [BitFieldInvalid]: Invalid bitfield flag or number: undefined
- All
SCREAMING_SNAKE_CASEenums have been changed toPascalCase - Intents:
Intents.FLAGS.GUILD_MESSAGES->GatewayIntentBits.GuildMessages - Permissions:
Permissions.FLAGS.SEND_MESSAGES->PermissionFlagsBits.SendMessages
As the bot said, Intents.FLAGS doesn’t work anymore in v14. Replace it by GatewayIntentBits
ok
Thanks!
Bot don't change the channel permissions.
If anyone knows why, please let me know.
channel permission change
and what exactly doesnt work
Because as of now you're only setting perms for the everyone role
oh
{
id: interaction.role.id,
allow: [PermissionsBitField.Flags.ViewChannel]
}
]);```
I want to change channel viewing permissions for certain roles every hour.
thats your roleid yes
yes
Can I change permissions for multiple channels at the same time?
Not with a single API call. But you can loop over channels and call the method on each of them
loop over channel? interesting
Or PermissionsFlagsBits.your-permission
intents arent permissions
Mb miss read
https://gist.github.com/anDromagnitude/0eca96ee3a2636712693c6652a174efb
Can this code be simplified?
Define your guild/channel/role outside of those crons. And define a named function doing what those crons currently do, then you can pass the same function to the two crons doing the same thing
Popular Topics: Permissions - Channel overwrites > Editing overwrites
