Только недавно начал изучать js, поэтому не совсем разбираюсь во всём. Подскажите, пожалуйста, почему выдаёт данную ошибку?
/home/runner/FakeSMS-Bot/node_modules/discord.js/src/client/Client.js:509
throw new DiscordjsTypeError(ErrorCodes.ClientMissingIntents);
^
TypeError [ClientMissingIntents]: Valid intents must be provided for the Client.
at Client._validateOptions (/home/runner/FakeSMS-Bot/node_modules/discord.js/src/client/Client.js:509:13)
at new Client (/home/runner/FakeSMS-Bot/node_modules/discord.js/src/client/Client.js:78:10)
at Object. (/home/runner/FakeSMS-Bot/index.js:5: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 {
code: 'ClientMissingIntents'
}
Node.js v18.16.1
exit status 1
Код:
const Discord = require('discord.js');
const mineflayer = require('mineflayer');
const client = new Discord.Client();
const token = 'token';
const mcBot = mineflayer.createBot({
host: 'ip',
port: 25565, // порт Minecraft сервера
username: 'FakeSMSBot',
});
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}`);
});
client.on('message', (message) => {
// Проверяем, что сообщение не от бота
if (message.author.bot) return;
mcBot.chat(message.content);
});
mcBot.on('chat', (username, message) => {
const channel = client.channels.cache.get('1160568256705339494');
if (channel) {
channel.send(`\**${username}:** ${message}`);
}
});
client.login(token);
mcBot.on('spawn', () => {
console.log('Connected to Minecraft server');
});