index.js
const { Client } = require( discord.js );
const Client = (module.exports = new Client({ intents: [131071] }));
const dotenv = require( dotenv );
dotenv.config();
Client.login(process.env.TOKEN);
Client.once( ready , async () => {
console.log( ${client.user.tag}(${client.user.id})로 로그인 되었습니다. );
});
여기까지 제가 원하는 코드를 작성하였습니다.
terminal
C:UsersinhuiDesktopdiscordindex.js:2
const Client = (module.exports = new Client({ intents: [131071] }));
^
SyntaxError: Identifier Client has already been declared
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1176:20)
at Module._compile (node:internal/modules/cjs/loader:1218:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Module._load (node:internal/modules/cjs/loader:958: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.16.0
하지만 터미널에서 코드가 먹히지 않고, 무엇이 잘못인지 확인되지가 않습니다. 무엇이 잘못 되었는지 확인이 필요합니다.