(Node version: 14.17.6)
When I type node .
in terminal, it gives me this issue:
throw new TypeError('CLIENT_MISSING_INTENTS'); ^
TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client. at Client._validateOptions (C:\Users\DELL\Desktop\Discord Bot\node_modules\discord.js\src\client\Client.js:544:13) at new Client (C:\Users\DELL\Desktop\Discord Bot\node_modules\discord.js\src\client\Client.js:73:10) at Object. (C:\Users\DELL\Desktop\Discord Bot\index.js:2:13) at Module._compile (internal/modules/cjs/loader.js:1072:14) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10) at Module.load (internal/modules/cjs/loader.js:937:32) at Function.Module._load (internal/modules/cjs/loader.js:778:12) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) at internal/main/run_main_module.js:17:47 { [Symbol(code)]: 'CLIENT_MISSING_INTENTS' }
what I wrote in VSC:
const Discord = require('discord.js');
const bot = new Discord.Client();
const token ='MY TOKEN';
bot.on('ready', () =>{
console.log('This bot is online!');
})
bot.on("message", msg=>{
if (msg.content === "HELLO"){
msg.reply('HELLO FRIEND!');
}
})
bot.login(token);
CodePudding user response:
Client doesn't have intents These would be your main ones
let bot = new Discord.Client({ intents: ["GUILDS", "GUILD_MESSAGES"] })