GatewayIntentBits seen as index.js property

Hi, I updated my discord.js to version @14.11 and wanted to update my intents, but somehow, GatewayIntentBits is seen as property of index.js and not if discord.js which means that i cant import Intents. Has anybody a solution for this? Code:
const {Discord, Client, GatewayIntentBits, Partials, Collection, MessageEmbed,} = require('discord.js');
const fs = require('fs');
const sleep = require('sleep-promise');

const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent],
partials: [Partials.Channel, Partials.Message]});
const {Discord, Client, GatewayIntentBits, Partials, Collection, MessageEmbed,} = require('discord.js');
const fs = require('fs');
const sleep = require('sleep-promise');

const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent],
partials: [Partials.Channel, Partials.Message]});
51 Replies
d.js toolkit
d.js toolkit2y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
ItIzYe
ItIzYeOP2y ago
Updated the IDE,restarted it but still same result...
sexy dark chocolate
What do you mean by seen as a property of index.js?
ItIzYe
ItIzYeOP2y ago
it doesn't get recognized as part of discord.js ergo i can't define intents ergo my Bot can't send messages
sexy dark chocolate
I'm confused, does it say that or error in the console?
ItIzYe
ItIzYeOP2y ago
No. just when i type i can see that it's porperty from index.js and intents don't get highlighted properly but there's no error in the console
sexy dark chocolate
What IDE are you using?
ItIzYe
ItIzYeOP2y ago
I tried it in IntelliJ and in VCS
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
ItIzYe
ItIzYeOP2y ago
Output from both IDEs
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
ItIzYe
ItIzYeOP2y ago
It just doesn't recognize GatewayIntentBits as part of discord.js but as part of index.js ergo i can't define the Intents
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
ItIzYe
ItIzYeOP2y ago
therefore
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
ItIzYe
ItIzYeOP2y ago
Hope this pictures help understanding the problem
ItIzYe
ItIzYeOP2y ago
i deleted GatewayIntentBits right before i took the screenshot and forgot to also delete the comma As you can see, VCS just shows it to me as a string and IntelliJ says it's property of index.js
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
ItIzYe
ItIzYeOP2y ago
No there are no errors in the console you think? I mean it should work properly in at least one of the IDEs
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
ItIzYe
ItIzYeOP2y ago
my Bot starts but doesn't reply to commands
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
ItIzYe
ItIzYeOP2y ago
both, prefix and slash
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
ItIzYe
ItIzYeOP2y ago
yes
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
ItIzYe
ItIzYeOP2y ago
yes, and i reinstalled discord.js
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
ItIzYe
ItIzYeOP2y ago
Yeah did this with VCS, shows me right syntax now but somehow still doesn't send messages
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
ItIzYe
ItIzYeOP2y ago
still no syntax error as before
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
ItIzYe
ItIzYeOP2y ago
i can, it's pretty long though
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
ItIzYe
ItIzYeOP2y ago
Pastebin
Code - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
ItIzYe
ItIzYeOP2y ago
Both don't send, slash commands might be bc they're not updated by now, but the messageCreate should be up do date as far as i'm concerned
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
ItIzYe
ItIzYeOP2y ago
yeah i put a log between the Event and the statement. Event gets triggered
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
d.js docs
d.js docs2y ago
If you aren't getting any errors, try to place console.log checkpoints throughout your code to find out where execution stops. • Once you do, log relevant values and if-conditions • More sophisticated debugging methods are breakpoints and runtime inspections: learn more
ItIzYe
ItIzYeOP2y ago
throw er; // Unhandled 'error' event
^

TypeError: Cannot read properties of undefined (reading 'execute')
throw er; // Unhandled 'error' event
^

TypeError: Cannot read properties of undefined (reading 'execute')
seems like this is the problem
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
ItIzYe
ItIzYeOP2y ago
okay, i took the command handler form the discord.js guide and this are the errors:
[WARNING] The command at C:\Users\user\OneDrive\Dokumente\Drippy.JS\src\commands\utility\help.js is missing a required "data" or "execute" property.
[WARNING] The command at C:\Users\user\OneDrive\Dokumente\Drippy.JS\src\commands\utility\help.js is missing a required "data" or "execute" property.
throw er; // Unhandled 'error' event
^

DiscordAPIError[10062]: Unknown interaction
throw er; // Unhandled 'error' event
^

DiscordAPIError[10062]: Unknown interaction
but i have data and execute in my help.js file :/ yes with module.export
module.exports = {
name: 'help',
description: 'Help Commands',
async execute (message, args) {
module.exports = {
name: 'help',
description: 'Help Commands',
async execute (message, args) {
that's how I export the commands
sexy dark chocolate
Missing a required data property, you're requiring the wrong commands That warning should be for a slashcommand
ItIzYe
ItIzYeOP2y ago
But it doesn’t work either when i use
module.exports = {
data: new SlashCommandBuilder()
module.exports = {
data: new SlashCommandBuilder()
And so on
sexy dark chocolate
Did you do this for all your other commands? And you have both data and execute properties
ItIzYe
ItIzYeOP2y ago
No only for the help command as its the only one im testing rn
sexy dark chocolate
Show the handler
ItIzYe
ItIzYeOP2y ago
Hope you understand it since my code is really messy rn
ItIzYe
ItIzYeOP2y ago
Its basically the handler from the discord.js guide no not anymore, but one of the errors gets triggered bythe help command
throw er; // Unhandled 'error' event
^

DiscordAPIError[10062]: Unknown interaction
throw er; // Unhandled 'error' event
^

DiscordAPIError[10062]: Unknown interaction
i think I also mentioned it earlier in the thread
ItIzYe
ItIzYeOP2y ago
this is the whole output
Want results from more Discord servers?
Add your server