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
d.js toolkit
d.js toolkit3mo 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!
Syjalo
Syjalo3mo ago
Show the full error
AquaticPear
AquaticPearOP3mo ago
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
Syjalo
Syjalo3mo ago
Is that app.js file?
AquaticPear
AquaticPearOP3mo ago
Yes
Syjalo
Syjalo3mo ago
You didn't save the file then
AquaticPear
AquaticPearOP3mo ago
I have it on save automaticallu automatically*
Syjalo
Syjalo3mo ago
It won't save if there's a conflict here. Do you use VS code?
AquaticPear
AquaticPearOP3mo ago
Yes
Syjalo
Syjalo3mo ago
Look at the file name at the top. Is there a white dot?
AquaticPear
AquaticPearOP3mo ago
No the only dot is the period in app.js
Syjalo
Syjalo3mo ago
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
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
AquaticPear
AquaticPearOP3mo ago
No its for me and my friends we're doing a test on a server we created
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
AquaticPear
AquaticPearOP3mo ago
Would it help if I sent a screenshot of the whole screen?
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
AquaticPear
AquaticPearOP3mo ago
I did it's saved but I still get that error
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
AquaticPear
AquaticPearOP3mo ago
Yes it recovered the history
AquaticPear
AquaticPearOP3mo ago
No description
AquaticPear
AquaticPearOP3mo ago
Maybe I did something in the developer portal wrong?
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
AquaticPear
AquaticPearOP3mo ago
How do I kill it
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
AquaticPear
AquaticPearOP3mo ago
Its not working still
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
AquaticPear
AquaticPearOP3mo ago
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
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
AquaticPear
AquaticPearOP3mo ago
No description
Syjalo
Syjalo3mo ago
You have your project in a different place. Do you deploy your code somewhere? Did you deploy the updated code?
AquaticPear
AquaticPearOP3mo ago
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?
Syjalo
Syjalo3mo ago
That's the thing you do. And that's out of the discord.js scope
AquaticPear
AquaticPearOP3mo ago
Wdym?
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
AquaticPear
AquaticPearOP3mo ago
From the site How do I run it locally?
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
Syjalo
Syjalo3mo ago
discord.js doesn't deploy anything to your site. We don't know how to do so
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
AquaticPear
AquaticPearOP3mo ago
Should the error be gone after that I got this error locally Error: Used disallowed intents
d.js docs
d.js docs3mo ago
- 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 Intents
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
AquaticPear
AquaticPearOP3mo ago
Okay ty I think it's fixed now
Want results from more Discord servers?
Add your server