Así que quería hacer un bot de discordia y cuando escribí node. en el CMD me dio un error. Mi código está abajo
const { Client, Intents } = require('discord.js'); const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] }); const client = new Discord.Client(); client.once('ready', () => { console.log('Better Call Saul!'); }); client.login('The code');Error:
lanzar nuevo TypeError('CLIENT_MISSING_INTENTS'); ^ TypeError [CLIENT_MISSING_INTENTS]: se deben proporcionar intentos válidos para el cliente. en Client._validateOptions (C:\Users\Uzivatel\Desktop\joe\node_modules\←[4mdiscord.js←[24m\src\client\Client.js:544:13) en el nuevo Cliente (C:\Users\Uzivatel\ Escritorio\joe\node_modules\←[4mdiscord.js←[24m\src\client\Client.js:73:10) en Objeto. (C:\Users\Uzivatel\Desktop\joe\main.js:3:16) ←[90m en Module._compile (node:internal/modules/cjs/loader:1101:14)←[39m ←[90m en Object .Módulo._extensiones..js
Parece que el problema está aquí:
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] }); const client = new Discord.Client();Sólo la primera línea es válida.