Мне выводит ошибку
C:\bot\node_modules\discord.js\src\client\Client.js:29
const Intents = require('../util/Intents');
^
SyntaxError: Identifier 'Intents' has already been declared
at Object.compileFunction (node:vm:352:18)
at Module._compile (node:internal/modules/cjs/loader:1065:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object. (C:\bot\node_modules\discord.js\src\index.js:5:18)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
Когда я пытаюсь запустить бота командой node bot.js. Что делать?
Код bot.js:
const Discord = require('discord.js');
const robot = new Client({ intents: [Intents.FLAGS.GUILDS] });
const comms = require("./comms.js");
const fs = require('fs');
let config = require('./config.json');
let token = config.token;
let prefix = config.prefix;
robot.on("ready", function() {
console.log(robot.user.username + " Started!");
});
robot.on('message', (msg) => {
if (msg.author.username != robot.user.username && msg.author.discriminator != robot.user.discriminator) {
var comm = msg.content.trim() + " ";
var comm_name = comm.slice(0, comm.indexOf(" "));
var messArr = comm.split(" ");
for (comm_count in comms.comms) {
var comm2 = prefix + comms.comms[comm_count].name;
if (comm2 == comm_name) {
comms.comms[comm_count].out(robot, msg, messArr);
}
}
}
});
robot.login(token)