Reputation: 1
So i wanted to make a discord bot and when I typed node . into the CMD it gave me a error. My code Is below
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:
throw new TypeError('CLIENT_MISSING_INTENTS'); ^ TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client. at Client._validateOptions (C:\Users\Uzivatel\Desktop\joe\node_modules\←[4mdiscord.js←[24m\src\client\Client.js:544:13) at new Client (C:\Users\Uzivatel\Desktop\joe\node_modules\←[4mdiscord.js←[24m\src\client\Client.js:73:10) at Object. (C:\Users\Uzivatel\Desktop\joe\main.js:3:16) ←[90m at Module._compile (node:internal/modules/cjs/loader:1101:14)←[39m ←[90m at Object.Module._extensions..js
Upvotes: 0
Views: 177
Reputation: 6642
It looks like the problem is here:
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
const client = new Discord.Client();
Only the first line is valid.
Upvotes: 1