I followed a tutorial by Codelyon. I followed it before but now it's not working. I don't know if I just typed something wrong and can't see it, or if I'm missing something completely different. Just to clarify, yes, I saved before typing node . and node main.js
Code
const Discord = require('discord.js');
const client = new Discord.Client();
client.once('ready', () => {
console.log('Kilobot is online')
});
client.login('bot token');
Error:
TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client.
AFAIK, in the new version you need to specify intents before doing any work. Here's a link on documentation.
// Require the necessary discord.js classes
const { Client, Intents } = require('discord.js');
const { token } = require('./config.json');
// Create a new client instance
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
// When the client is ready, run this code (only once)
client.once('ready', () => {
console.log('Ready!');
});
// Login to Discord with your client's token
client.login(token);
And your question is already asked on stackoverflow, in here