Code for my Discord Bot

Ok, I’m new to coding so I might be dumb while I’m asking this question but I’m coding for my Discord bot and I’m just trying to make the bot online. Everytime I do node . on command prompt, I get the same message everytime:

throw new TypeError(‘CLIENT_MISSING_INTENTS’);

TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client.
at new Client (C:\Users\ADMIN\Desktop\YayBot\node_modules\discord.js\src\client\Client.js:76:10)
at Object. (C:\Users\ADMIN\Desktop\YayBot\main.js:2: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 {

… and the code I put in is

const Discord = require ('discord.js');
const client = new Discord.Client();

client.on('ready', () => {
    console.log('Bot is ready!');

client.login('My Token');
1 Like


You need to specify the events which you want your bot to receive using gateway intents.

So instead of:

const client = new Discord.Client();


const client = new Discord.Client({ intents: [Enter intents here] })

For example:

const client = new Discord.Client({ intents: ["GUILDS", "GUILD_MESSAGES"] })

The above answer was copied from here:


This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.