Estoy programando un bot de Discord y no puedo deshacerme de este error. Ya he visto un par de soluciones que funcionaron para otros pero no funciona para mí... Sigo recibiendo este error:
throw new TypeError('CLIENT_MISSING_INTENTS'); ^ TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client. at Client._validateOptions (C:\Users\User\Desktop\discordBot\node_modules\discord.js\src\client\Client.js:548:13) at new Client (C:\Users\User\Desktop\discordBot\node_modules\discord.js\src\client\Client.js:76:10) at Object.<anonymous> (C:\Users\User\Desktop\discordBot\main.js:3:16) at Module._compile (node:internal/modules/cjs/loader:1101:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:17:47 { [Symbol(code)]: 'CLIENT_MISSING_INTENTS' }
este es mi código main.js:
const Discord = require('discord.js'); const client = new Discord.Client({ partials: ["MESSAGE", "CHANNEL", "REACTION" ]}); const prefix = '-'; const fs = require('fs'); client.commands = new Discord.Collection(); const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js')); for (const file of commandFiles) { const command = require(`./commands/${file}`); client.commands.set(command.name, command); } client.on('ready', () => { console.log('bot is online!'); }); client.on('message', message => { if (!message.content.startsWith(prefix) || message.author.bot) return; const args = message.content.slice(prefix.length).split(/ +/); const command = args.shift().toLowerCase(); if (command === 'reactionrole') { client.commands.get('reactionrole').execute(message, args, Discord, client); } }); client.login('TOKEN');¿alguien sabe que puedo hacer al respecto?
Le falta el campo de intenciones al crear un nuevo cliente. Reemplazar
const client = new Discord.Client({ partials: ["MESSAGE", "CHANNEL", "REACTION" ]});con
const client = new Discord.Client({ partials: ["MESSAGE", "CHANNEL", "REACTION" ], intents: ["GUILDS", /* Other intents... */]});