channel permission change

I'm a beginner. If you don't mind, please teach me.
51 Replies
d.js toolkit
d.js toolkit•8mo ago
- 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!
!!anDro
!!anDroOP•8mo ago
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.
Mark
Mark•8mo ago
this sounds like a perfect use of a cron job
!!anDro
!!anDroOP•8mo ago
cron?
Mark
Mark•8mo ago
npm
node-cron
A simple cron-like task scheduler for Node.js. Latest version: 3.0.3, last published: 8 months ago. Start using node-cron in your project by running npm i node-cron. There are 1216 other projects in the npm registry using node-cron.
!!anDro
!!anDroOP•8mo ago
ok thx What should I do from here lol
Mark
Mark•8mo ago
set up a cron job to run at the specified times to change the permission overwrites of the channels
d.js docs
d.js docs•8mo ago
:guide: Popular Topics: Permissions - Channel overwrites > Editing overwrites read more
!!anDro
!!anDroOP•8mo ago
No description
!!anDro
!!anDroOP•8mo ago
🤔
!!anDro
!!anDroOP•8mo ago
what is this
No description
!!anDro
!!anDroOP•8mo ago
ok
!!anDro
!!anDroOP•8mo ago
That's terrible code. I don't know how to write js. Should I just put the ID in guild.id as is?
Unknown User
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
!!anDro
!!anDroOP•8mo ago
hmmm I'll try it
CXazertyuuu
CXazertyuuu•8mo ago
and i would advise to learn typescript it has been less painful for me
can
can•8mo ago
typescript isnt that good
!!anDro
!!anDroOP•8mo ago
No description
!!anDro
!!anDroOP•8mo ago
Unknown User
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
d.js docs
d.js docs•8mo ago
- ReferenceError: "x" is not defined: learn more - TypeError: Cannot read properties of undefined/null (reading "x"): learn more
Unknown User
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
!!anDro
!!anDroOP•8mo ago
ok
!!anDro
!!anDroOP•8mo ago
!!anDro
!!anDroOP•8mo ago
No description
!!anDro
!!anDroOP•8mo ago
:FeelsBadMan:
VIX
VIX•8mo ago
what version of discordjs do you have
!!anDro
!!anDroOP•8mo ago
14.15.3
d.js docs
d.js docs•8mo ago
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
VIX
VIX•8mo ago
As the bot said, Intents.FLAGS doesn’t work anymore in v14. Replace it by GatewayIntentBits
!!anDro
!!anDroOP•7mo ago
ok Thanks! Bot don't change the channel permissions. If anyone knows why, please let me know.
d.js docs
d.js docs•7mo ago
To share long code snippets, use a service like gist, sourcebin, pastebin, or similar instead of posting them as large code blocks or files.
!!anDro
!!anDroOP•7mo ago
ok
treble/luna
treble/luna•7mo ago
and what exactly doesnt work Because as of now you're only setting perms for the everyone role
!!anDro
!!anDroOP•7mo ago
oh
channel.permissionOverwrites.set([
{
id: interaction.role.id,
allow: [PermissionsBitField.Flags.ViewChannel]
}
]);
channel.permissionOverwrites.set([
{
id: interaction.role.id,
allow: [PermissionsBitField.Flags.ViewChannel]
}
]);
treble/luna
treble/luna•7mo ago
there is no interaction.role Not sure what you're trying to achieve
!!anDro
!!anDroOP•7mo ago
I want to change channel viewing permissions for certain roles every hour.
treble/luna
treble/luna•7mo ago
then pass in the role id Which you had defined in the gist you showed
!!anDro
!!anDroOP•7mo ago
No description
!!anDro
!!anDroOP•7mo ago
Is this?
treble/luna
treble/luna•7mo ago
thats your roleid yes
!!anDro
!!anDroOP•7mo ago
No description
treble/luna
treble/luna•7mo ago
yes
!!anDro
!!anDroOP•7mo ago
It work! thanks! Can I change permissions for multiple channels at the same time? loop over channel? interesting
izexi
izexi•7mo ago
Or PermissionsFlagsBits.your-permission
treble/luna
treble/luna•7mo ago
intents arent permissions
izexi
izexi•7mo ago
Mb miss read
!!anDro
!!anDroOP•7mo ago
Gist
channeltimer.js
GitHub Gist: instantly share code, notes, and snippets.
!!anDro
!!anDroOP•7mo ago

Did you find this page helpful?