Cannot read properties of undefined (reading 'FLAGS')

I get the error above, here is the error:
Uncaught TypeError TypeError: Cannot read properties of undefined (reading 'FLAGS')
at <anonymous> (c:\Users\theor\3D Objects\discord-bot\commands\support\TicketSystem.js:14:15)
at Module._compile (internal/modules/cjs/loader:1256:14)
at Module._extensions..js (internal/modules/cjs/loader:1310:10)
at Module.load (internal/modules/cjs/loader:1119:32)
at Module._load (internal/modules/cjs/loader:960:12)
at Module.require (internal/modules/cjs/loader:1143:19)
at require (internal/modules/cjs/helpers:119:18)
at <anonymous> (c:\Users\theor\3D Objects\discord-bot\deploy-commands.js:18:19)
at Module._compile (internal/modules/cjs/loader:1256:14)
at Module._extensions..js (internal/modules/cjs/loader:1310:10)
at Module.load (internal/modules/cjs/loader:1119:32)
at Module._load (internal/modules/cjs/loader:960:12)
at executeUserEntryPoint (internal/modules/run_main:86:12)
at <anonymous> (internal/main/run_main_module:23:47)
Uncaught TypeError TypeError: Cannot read properties of undefined (reading 'FLAGS')
at <anonymous> (c:\Users\theor\3D Objects\discord-bot\commands\support\TicketSystem.js:14:15)
at Module._compile (internal/modules/cjs/loader:1256:14)
at Module._extensions..js (internal/modules/cjs/loader:1310:10)
at Module.load (internal/modules/cjs/loader:1119:32)
at Module._load (internal/modules/cjs/loader:960:12)
at Module.require (internal/modules/cjs/loader:1143:19)
at require (internal/modules/cjs/helpers:119:18)
at <anonymous> (c:\Users\theor\3D Objects\discord-bot\deploy-commands.js:18:19)
at Module._compile (internal/modules/cjs/loader:1256:14)
at Module._extensions..js (internal/modules/cjs/loader:1310:10)
at Module.load (internal/modules/cjs/loader:1119:32)
at Module._load (internal/modules/cjs/loader:960:12)
at executeUserEntryPoint (internal/modules/run_main:86:12)
at <anonymous> (internal/main/run_main_module:23:47)
Here is my code:
const { Client, Intents } = require('discord.js');
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const path = require('path');

// Construct the absolute path to config.json
const configPath = path.join(__dirname, '../../config.json');

// Require the configuration file
const { token, clientId } = require(configPath);

const client = new Client({
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES, // Add this if you want to handle messages.
],
});
const { Client, Intents } = require('discord.js');
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const path = require('path');

// Construct the absolute path to config.json
const configPath = path.join(__dirname, '../../config.json');

// Require the configuration file
const { token, clientId } = require(configPath);

const client = new Client({
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES, // Add this if you want to handle messages.
],
});

(stops here with not enough space)
3 Replies
d.js toolkit
d.js toolkit15mo 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! - Marked as resolved by staff
d.js docs
d.js docs15mo ago
Tag suggestion for @RoreosNFishnets: RangeError [BitFieldInvalid]: Invalid bitfield flag or number: undefined - All SCREAMING_SNAKE_CASE enums have been changed to PascalCase - Intents: Intents.FLAGS.GUILD_MESSAGES -> GatewayIntentBits.GuildMessages - Permissions: Permissions.FLAGS.SEND_MESSAGES -> PermissionFlagsBits.SendMessages - ReferenceError: "x" is not defined: learn more - TypeError: Cannot read properties of undefined/null (reading "x"): learn more
Roreos
RoreosOP15mo ago
Thank you
Want results from more Discord servers?
Add your server