Using intents in V14
I just updated a repo to v14 but cannot figure out how to wrangle intents at all. Can someone show me code that works correctly with the intents?
The latest code that worked was something like
and now it gives TypeError [ClientMissingIntents]: Valid intents must be provided for the Client.
at Client._validateOptions (/home/thetis/coding/SI_Card_Bot/node_modules/discord.js/src/client/Client.js:512:13)
at new Client (/home/thetis/coding/SI_Card_Bot/node_modules/discord.js/src/client/Client.js:80:10)
13 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!- Websocket intents limit events and decrease memory usage: learn more
- See what intents you need here
I've tried reading both and still don't get it unfortunately. Something about the bot just stops working even if I give it some intents
Let me try one of the codes and show
For example
I use this code, and the bot starts without any errors. And then does not change its own status or reply to
-help
anymore
I cant tell why, do I need to specify a separate intent for every little thing? Send Messages, MessageContent, change Status etc?You don't need intents for sending messages/changing your own status, how are you doing all that? Show the relevant code
GitHub
SI_Card_Bot/index.js at main · TheOriginalSoni/SI_Card_Bot
Discord App for Spirit island. Contribute to TheOriginalSoni/SI_Card_Bot development by creating an account on GitHub.
I am basically updating to v14 so it can use forum posts and threads again
Sorry I'm not well versed in JS, I usually use python for things, so just learning as I go
You clearly didn't, because that is not v14, also you do not specify any intents when initiating your client
The events you are listening to are outdated, activity type, use
ActivityType
enum, just read the updating guideI just committed the code I was running locally latest. That's just the code I already shared above
Also, its activities in v14 which takes an array, follow this doc
Okay, that just added the intents, rest of the stuff is still the same
the event
message
-> messageCreate
, for settinf the presence, check the doc i linkedYeah reading.
I didnt write the repo so still picking up all NodeJs and Discord.js stuff at once
I think I managed to get it work. Had to replace message with messagecreate and I think that was all?
Thank you, it took me a while to understand what all changes needed to be followed. The full list of V13 V14 events is a bit hard to parse