Answer the question
In order to leave comments, you need to log in
What to do with SyntaxError: Identifier has already been declared?
Gives me an error
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)
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)
Answer the question
In order to leave comments, you need to log in
Good evening, replace Intents with something else, it has already been announced earlier.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question