channel permission change

I'm a beginner. If you don't mind, please teach me.
51 Replies
d.js toolkit
d.js toolkit•5mo 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•5mo 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•5mo ago
this sounds like a perfect use of a cron job
! ! anDro
! ! anDroOP•5mo ago
cron?
Mark
Mark•5mo 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•5mo ago
ok thx What should I do from here lol
Mark
Mark•5mo 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•5mo ago
:guide: Popular Topics: Permissions - Channel overwrites > Editing overwrites read more
! ! anDro
! ! anDroOP•5mo ago
No description
! ! anDro
! ! anDroOP•5mo ago
🤔
! ! anDro
! ! anDroOP•5mo ago
what is this
No description
! ! anDro
! ! anDroOP•5mo ago
ok
! ! anDro
! ! anDroOP•5mo 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•5mo ago
Message Not Public
Sign In & Join Server To View
! ! anDro
! ! anDroOP•5mo ago
hmmm I'll try it
CXazertyuuu
CXazertyuuu•5mo ago
and i would advise to learn typescript it has been less painful for me
can
can•5mo ago
typescript isnt that good
! ! anDro
! ! anDroOP•5mo ago
No description
Unknown User
Unknown User•5mo ago
Message Not Public
Sign In & Join Server To View
d.js docs
d.js docs•5mo ago
- ReferenceError: "x" is not defined: learn more - TypeError: Cannot read properties of undefined/null (reading "x"): learn more
Unknown User
Unknown User•5mo ago
Message Not Public
Sign In & Join Server To View
! ! anDro
! ! anDroOP•5mo ago
ok
! ! anDro
! ! anDroOP•5mo ago
! ! anDro
! ! anDroOP•5mo ago
No description
! ! anDro
! ! anDroOP•5mo ago
:FeelsBadMan:
VIX
VIX•5mo ago
what version of discordjs do you have
! ! anDro
! ! anDroOP•5mo ago
14.15.3
d.js docs
d.js docs•5mo 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•5mo ago
As the bot said, Intents.FLAGS doesn’t work anymore in v14. Replace it by GatewayIntentBits
! ! anDro
! ! anDroOP•4mo ago
ok Thanks! Bot don't change the channel permissions. If anyone knows why, please let me know.
d.js docs
d.js docs•4mo 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•4mo ago
ok
treble/luna
treble/luna•4mo ago
and what exactly doesnt work Because as of now you're only setting perms for the everyone role
! ! anDro
! ! anDroOP•4mo 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•4mo ago
there is no interaction.role Not sure what you're trying to achieve
! ! anDro
! ! anDroOP•4mo ago
I want to change channel viewing permissions for certain roles every hour.
treble/luna
treble/luna•4mo ago
then pass in the role id Which you had defined in the gist you showed
! ! anDro
! ! anDroOP•4mo ago
No description
! ! anDro
! ! anDroOP•4mo ago
Is this?
treble/luna
treble/luna•4mo ago
thats your roleid yes
! ! anDro
! ! anDroOP•4mo ago
No description
treble/luna
treble/luna•4mo ago
yes
! ! anDro
! ! anDroOP•4mo ago
It work! thanks! Can I change permissions for multiple channels at the same time? loop over channel? interesting
Yiannakis Papadopoulos
Or PermissionsFlagsBits.your-permission
treble/luna
treble/luna•4mo ago
intents arent permissions
Yiannakis Papadopoulos
Mb miss read
! ! anDro
! ! anDroOP•4mo ago
Gist
channeltimer.js
GitHub Gist: instantly share code, notes, and snippets.
! ! anDro
! ! anDroOP•4mo ago
Want results from more Discord servers?
Add your server