51 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!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?
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.ok
thx
What should I do from here lol
set up a cron job to run at the specified times to change the permission overwrites of the channels
🤔
what is this
ok
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•5mo ago
Message Not Public
Sign In & Join Server To View
hmmm
I'll try it
and i would advise to learn typescript it has been less painful for me
typescript isnt that good
Unknown User•5mo ago
Message Not Public
Sign In & Join Server To View
-
ReferenceError: "x" is not defined
: learn more
- TypeError: Cannot read properties of undefined/null (reading "x")
: learn moreUnknown User•5mo ago
Message Not Public
Sign In & Join Server To View
ok
:FeelsBadMan:
what version of discordjs do you have
14.15.3
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
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.
ok
and what exactly doesnt work
Because as of now you're only setting perms for the everyone role
oh
there is no interaction.role
Not sure what you're trying to achieve
I want to change channel viewing permissions for certain roles every hour.
then pass in the role id
Which you had defined in the gist you showed
Is this?
thats your roleid yes
yes
It work!
thanks!
Can I change permissions for multiple channels at the same time?
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?