При запуске бота Discord на JS появляется ошибка:
SyntaxError: Identifier 'client' has already been declared
Код:
const Discord = require('discord.js');
const client = new Discord.Client();
const { Client, Intents } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
let config = require('./botconfig.json');
let token = config.token;
let prefix = config.prefix;
client.on(`ready`, () => {
console.log(`Зарегистрирован в ${client.user.username}.`);
});
client.on('message', msg => {
if (msg.content === 'ping') {
msg.reply('Pong!');
}
});
client.login(token);