Я создал бота, но он не запускается.
код:
const Discord = require('discord.js');
const client = new Discord.Client();
let config = require('./botconfig.json');
let token = config.token;
let prefix = config.prefix;
client.on('ready', () => {
console.log(`Запустился бот ${client.user.username}`);
});
//команда, и то, что она должна выполнить
client.on('message', message => {
if (message.content === prefix + 'pong') {
message.reply('Ping!');
}
});
client.login(token);
ошибка:
throw new TypeError('CLIENT_MISSING_INTENTS');
^
TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client.
at Client._validateOptions (C:\Users\User\OneDrive\Рабочий стол\Games\Discord.js\testBot\node_modules\←[4mdiscord.js←[24m\src\client\Client.js:544:13)
at new Client (C:\Users\User\OneDrive\Рабочий стол\Games\Discord.js\testBot\node_modules\←[4mdiscord.js←[24m\src\client\Client.js:73:10)
at Object.<anonymous> (C:\Users\User\OneDrive\Рабочий стол\Games\Discord.js\testBot\bot.js:2:13)
←[90m at Module._compile (node:internal/modules/cjs/loader:1101:14)←[39m
←[90m at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)←[39m
←[90m at Module.load (node:internal/modules/cjs/loader:981:32)←[39m
←[90m at Function.Module._load (node:internal/modules/cjs/loader:822:12)←[39m
←[90m at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)←[39m
←[90m at node:internal/main/run_main_module:17:47←[39m {
[←[32mSymbol(code)←[39m]: ←[32m'CLIENT_MISSING_INTENTS'←[39m
В консоле писал:
npm init
npm install
npm install discord.js