Top.Mail.Ru
Ответы

Выдают ошибку бот дискорде помогите! (Visual Stido)

TypeError [ClientMissingIntents]: Valid intents must be provided for the Client.
at Client._validateOptions (C:\Users\Tutae\node_modules\discord.js\src\client\Client.js:529:13)
at new Client (C:\Users\Tutae\node_modules\discord.js\src\client\Client.js:80:10)
at Object.<anonymous> (C:\Users\Tutae\bot.js:2:13)
at Module._compile (node:internal/modules/cjs/loader:1358:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
at Module.load (node:internal/modules/cjs/loader:1208:32)
at Module._load (node:internal/modules/cjs/loader:1024:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
at node:internal/main/run_main_module:28:49 {
code: 'ClientMissingIntents'
}

Node.js v20.14.0

12345678910111213141516171819
 const Discord = require('discord.js'); 
const bot = new Discord.Client(); 
let config = require('./botconfing.json') 
let token = config.token 
let prefix = config.prefix 
 
bot.on('ready', () => { 
  console.log(`Bot connected ${bot.user.username}`); 
}); 
 
bot.on('interactionCreate', async interaction => { 
  if (!interaction.isCommand()) return; 
 
  if (interaction.commandName === 'ping') { 
    await interaction.reply('Pong!'); 
  } 
}); 
 
bot.login(token); 
Только авторизированные пользователи могут оставлять свои ответы
Дата
Популярность
Аватар пользователя
Мастер
7мес

В node.js не разбираюсь, но ошибка ясна: у бота отключены интенты. Подключи их и в портале разработчика и в коде.

Код: https://discordjs.guide/popular-topics/intents.html#enabling-intents