Hachiko ✨ Rook
DIAdiscord.js - Imagine an app
•Created by Hachiko ✨ Rook on 11/11/2024 in #djs-questions
Following a tutorial from 2020 and unsure of how I'm supposed to define Intents.
I'm following this tutorial by Sethey17 to make a simple Discord bot for my server that would be able to bulk delete messages in response to a command.
https://www.youtube.com/watch?v=fx6oJ4PQDOs
I'm on step two and I keep getting the following error when I try to run the code in the terminal. I've checked the code for typos and used JSHint.
From what I can understand and find online (mind you, this is the first time I've ever made a bot or used Javascript) this is because Discord needs me to set the permissions for the bot via Intents. I can't seem to get a confirmation on exactly how to do this anywhere online, other than that the way used in Sethey17's tutorial may no longer be correct. How do I fix this so I can move on to the next step?
Node.js v22.11.0
PS C:\Users\dogkn\Documents\Tomatogen> node index.js
C:\Users\dogkn\Documents\Tomatogen\node_modules\discord.js\src\client\Client.js:529
throw new DiscordjsTypeError(ErrorCodes.ClientMissingIntents);
^
TypeError [ClientMissingIntents]: Valid intents must be provided for the Client.
at Client._validateOptions (C:\Users\dogkn\Documents\Tomatogen\node_modules\discord.js\src\client\Client.js:529:13)
at new Client (C:\Users\dogkn\Documents\Tomatogen\node_modules\discord.js\src\client\Client.js:80:10)
at Object.<anonymous> (C:\Users\dogkn\Documents\Tomatogen\index.js:2:13)
at Module._compile (node:internal/modules/cjs/loader:1546:14)
at Object..js (node:internal/modules/cjs/loader:1689:10)
at Module.load (node:internal/modules/cjs/loader:1318:32)
at Function._load (node:internal/modules/cjs/loader:1128:12)
at TracingChannel.traceSync (node:diagnostics_channel:315:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:218:24)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:170:5) {
code: 'ClientMissingIntents'
}
30 replies