Help

Code - https://pastebin.com/s8s53Cqj Error -
C:\Users\User\Desktop\Музыкальный Бот\src\structures\MusicClient.js:16
Intents.FLAGS.GUILDS,
^

TypeError: Cannot read properties of undefined (reading 'FLAGS')
at new MusicBot (C:\Users\User\Desktop\Музыкальный Бот\src\structures\MusicClient.js:16:17)
at Object.<anonymous> (C:\Users\User\Desktop\Музыкальный Бот\src\index.js:2:16)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47

Node.js v18.17.0
C:\Users\User\Desktop\Музыкальный Бот\src\structures\MusicClient.js:16
Intents.FLAGS.GUILDS,
^

TypeError: Cannot read properties of undefined (reading 'FLAGS')
at new MusicBot (C:\Users\User\Desktop\Музыкальный Бот\src\structures\MusicClient.js:16:17)
at Object.<anonymous> (C:\Users\User\Desktop\Музыкальный Бот\src\index.js:2:16)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47

Node.js v18.17.0
6 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 OP
d.js docs
d.js docs15mo ago
Tag suggestion for @Обкуренный: 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
Обкуренный
C:\Users\User\Desktop\Музыкальный Бот\src\structures\MusicClient.js:16
GatewayIntentBits.Guild,
^

ReferenceError: GatewayIntentBits is not defined
at new MusicBot (C:\Users\User\Desktop\Музыкальный Бот\src\structures\MusicClient.js:16:9)
at Object.<anonymous> (C:\Users\User\Desktop\Музыкальный Бот\src\index.js:2:16)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47

Node.js v18.17.0
C:\Users\User\Desktop\Музыкальный Бот\src\structures\MusicClient.js:16
GatewayIntentBits.Guild,
^

ReferenceError: GatewayIntentBits is not defined
at new MusicBot (C:\Users\User\Desktop\Музыкальный Бот\src\structures\MusicClient.js:16:9)
at Object.<anonymous> (C:\Users\User\Desktop\Музыкальный Бот\src\index.js:2:16)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47

Node.js v18.17.0
treble/luna
treble/luna15mo ago
Import it Also its Guilds
Обкуренный
const chalk = require("chalk");
const moment = require("moment");

module.exports = class Logger {
static log (content, type = "log") {
const date = `${moment().format("DD-MM-YYYY hh:mm:ss")}`;
switch (type) {

case "log": {
return console.log(`[${chalk.yellow(date)}]: [${chalk.black.bgBlue(type.toUpperCase())}] ${chalk.blue(content)}`);
}
case "warn": {
return console.log(`[${chalk.yellow(date)}]: [${chalk.black.bgYellow(type.toUpperCase())}] ${chalk.blue(content)}`);
}
case "error": {
return console.log(`[${chalk.yellow(date)}]: [${chalk.black.bgRed(type.toUpperCase())}] ${chalk.blue(content)}`);
}
case "debug": {
return console.log(`[${chalk.yellow(date)}]: [${chalk.black.bgGreen(type.toUpperCase())}] ${chalk.blue(content)}`);
}
case "cmd": {
return console.log(`[${chalk.yellow(date)}]: [${chalk.black.bgWhite(type.toUpperCase())}] ${chalk.blue(content)}`);
}
case "event": {
return console.log(`[${chalk.yellow(date)}]: [${chalk.black.bgHex('#e1f507')(type.toUpperCase())}] ${chalk.blue(content)}`);
}
case "ready": {
return console.log(`[${chalk.yellow(date)}]: [${chalk.black.bgHex('#067032')(type.toUpperCase())}] ${chalk.blue(content)}`);
}
default: throw new TypeError("Logger type must be either warn, debug, log, ready, cmd or error.");
}
}
};
const chalk = require("chalk");
const moment = require("moment");

module.exports = class Logger {
static log (content, type = "log") {
const date = `${moment().format("DD-MM-YYYY hh:mm:ss")}`;
switch (type) {

case "log": {
return console.log(`[${chalk.yellow(date)}]: [${chalk.black.bgBlue(type.toUpperCase())}] ${chalk.blue(content)}`);
}
case "warn": {
return console.log(`[${chalk.yellow(date)}]: [${chalk.black.bgYellow(type.toUpperCase())}] ${chalk.blue(content)}`);
}
case "error": {
return console.log(`[${chalk.yellow(date)}]: [${chalk.black.bgRed(type.toUpperCase())}] ${chalk.blue(content)}`);
}
case "debug": {
return console.log(`[${chalk.yellow(date)}]: [${chalk.black.bgGreen(type.toUpperCase())}] ${chalk.blue(content)}`);
}
case "cmd": {
return console.log(`[${chalk.yellow(date)}]: [${chalk.black.bgWhite(type.toUpperCase())}] ${chalk.blue(content)}`);
}
case "event": {
return console.log(`[${chalk.yellow(date)}]: [${chalk.black.bgHex('#e1f507')(type.toUpperCase())}] ${chalk.blue(content)}`);
}
case "ready": {
return console.log(`[${chalk.yellow(date)}]: [${chalk.black.bgHex('#067032')(type.toUpperCase())}] ${chalk.blue(content)}`);
}
default: throw new TypeError("Logger type must be either warn, debug, log, ready, cmd or error.");
}
}
};
C:\Users\User\Desktop\Музыкальный Бот\src\utils\logger.js:1
const chalk = require("chalk");
^
Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Users\User\Desktop\Музыкальный Бот\node_modules\chalk\source\index.js from C:\Users\User\Desktop\Музыкальный Бот\src\utils\logger.js not supported.
Instead change the require of index.js in C:\Users\User\Desktop\Музыкальный Бот\src\utils\logger.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (C:\Users\User\Desktop\Музыкальный Бот\src\utils\logger.js:1:15)
at new MusicBot (C:\Users\User\Desktop\Музыкальный Бот\src\structures\MusicClient.js:29:19)
at Object.<anonymous> (C:\Users\User\Desktop\Музыкальный Бот\src\index.js:2:16) {
code: 'ERR_REQUIRE_ESM'
}

Node.js v18.17.0
PS C:\Users\User\Desktop\Музыкальный Бот\src> node .
C:\Users\User\Desktop\Музыкальный Бот\src\utils\logger.js:1
const { chalk } = require("chalk");
^

Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Users\User\Desktop\Музыкальный Бот\node_modules\chalk\source\index.js from C:\Users\User\Desktop\Музыкальный Бот\src\utils\logger.js not supported.
Instead change the require of index.js in C:\Users\User\Desktop\Музыкальный Бот\src\utils\logger.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (C:\Users\User\Desktop\Музыкальный Бот\src\utils\logger.js:1:19)
at new MusicBot (C:\Users\User\Desktop\Музыкальный Бот\src\structures\MusicClient.js:29:19)
at Object.<anonymous> (C:\Users\User\Desktop\Музыкальный Бот\src\index.js:2:16) {
code: 'ERR_REQUIRE_ESM'
}

Node.js v18.17.0
C:\Users\User\Desktop\Музыкальный Бот\src\utils\logger.js:1
const chalk = require("chalk");
^
Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Users\User\Desktop\Музыкальный Бот\node_modules\chalk\source\index.js from C:\Users\User\Desktop\Музыкальный Бот\src\utils\logger.js not supported.
Instead change the require of index.js in C:\Users\User\Desktop\Музыкальный Бот\src\utils\logger.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (C:\Users\User\Desktop\Музыкальный Бот\src\utils\logger.js:1:15)
at new MusicBot (C:\Users\User\Desktop\Музыкальный Бот\src\structures\MusicClient.js:29:19)
at Object.<anonymous> (C:\Users\User\Desktop\Музыкальный Бот\src\index.js:2:16) {
code: 'ERR_REQUIRE_ESM'
}

Node.js v18.17.0
PS C:\Users\User\Desktop\Музыкальный Бот\src> node .
C:\Users\User\Desktop\Музыкальный Бот\src\utils\logger.js:1
const { chalk } = require("chalk");
^

Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Users\User\Desktop\Музыкальный Бот\node_modules\chalk\source\index.js from C:\Users\User\Desktop\Музыкальный Бот\src\utils\logger.js not supported.
Instead change the require of index.js in C:\Users\User\Desktop\Музыкальный Бот\src\utils\logger.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (C:\Users\User\Desktop\Музыкальный Бот\src\utils\logger.js:1:19)
at new MusicBot (C:\Users\User\Desktop\Музыкальный Бот\src\structures\MusicClient.js:29:19)
at Object.<anonymous> (C:\Users\User\Desktop\Музыкальный Бот\src\index.js:2:16) {
code: 'ERR_REQUIRE_ESM'
}

Node.js v18.17.0
treble/luna
treble/luna15mo ago
Not djs related, #other-js-ts
Want results from more Discord servers?
Add your server