#channel permission change

69 messages · Page 1 of 1 (latest)

river jewel
#

I'm a beginner. If you don't mind, please teach me.

sage pierBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • 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!
thick radish
#

You can’t change the user‘s UI without them interacting with anything, if that’s what you mean

river jewel
#

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.

junior wave
#

this sounds like a perfect use of a cron job

river jewel
#

cron?

junior wave
#
river jewel
#

ok

#

thx

#

What should I do from here lol

junior wave
#

set up a cron job to run at the specified times to change the permission overwrites of the channels

topaz trellisBOT
#

guide Popular Topics: Permissions - Channel overwrites > Editing overwrites
read more

river jewel
#

🤔

#

what is this

thick radish
#

Read the package‘s documentation. Not djs related

river jewel
#

ok

river jewel
stark cloud
river jewel
#

hmmm

#

I'll try it

azure chasm
#

and i would advise to learn typescript it has been less painful for me

worldly blaze
river jewel
dusky sandal
#

it’s basic javascript

topaz trellisBOT
#
  • ReferenceError: "x" is not defined: learn more
  • TypeError: Cannot read properties of undefined/null (reading "x"): learn more
dusky sandal
#

error doesn’t match code anyway

#

make sure your code is saved

river jewel
#

ok

river jewel
ancient owl
#

what version of discordjs do you have

river jewel
#

14.15.3

topaz trellisBOT
#

RangeError [BitFieldInvalid]: Invalid bitfield flag or number: undefined

  • All SCREAMING_SNAKE_CASE enums have been changed to PascalCase
  • Intents: Intents.FLAGS.GUILD_MESSAGES -> GatewayIntentBits.GuildMessages
  • Permissions: Permissions.FLAGS.SEND_MESSAGES -> PermissionFlagsBits.SendMessages
ancient owl
#

As the bot said, Intents.FLAGS doesn’t work anymore in v14. Replace it by GatewayIntentBits

river jewel
#

Bot don't change the channel permissions.
If anyone knows why, please let me know.

#

channel permission change

topaz trellisBOT
#

To share long code snippets, use a service like gist, sourcebin, pastebin, or similar instead of posting them as large code blocks or files.

river jewel
#

ok

opaque patrol
#

and what exactly doesnt work

#

Because as of now you're only setting perms for the everyone role

river jewel
#

oh

river jewel
#
    {
    id: interaction.role.id,
    allow: [PermissionsBitField.Flags.ViewChannel]
    }
]);```
opaque patrol
#

there is no interaction.role

#

Not sure what you're trying to achieve

river jewel
#

I want to change channel viewing permissions for certain roles every hour.

opaque patrol
#

then pass in the role id

#

Which you had defined in the gist you showed

river jewel
#

Is this?

opaque patrol
#

thats your roleid yes

river jewel
opaque patrol
#

yes

river jewel
#

It work!

#

thanks!

river jewel
#

Can I change permissions for multiple channels at the same time?

thick radish
#

Not with a single API call. But you can loop over channels and call the method on each of them

river jewel
#

loop over channel? interesting

echo nova
opaque patrol
echo nova
#

Mb miss read

river jewel
thick radish
#

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