Question:
IT NOT working it’s giving me a weird error.
TypeError [ClientMissingIntents]: Valid inte nts must be provided for the Client.
at Client._validate0ptions (/home/runner
/E-Pella/node_modules/discord.js/src/client/ Client.js:489:13)
Repl link:
<can’t give it>
code snippet
const Discord = require('discord.js');
const client = new Discord.Client();
const prefix = '!';
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}`);
});
You must pass intents to the discord bot. I have seen them passed as ints, and as individual permissions.
1 Like
how can you help be with the code for my Discord bot plz
If you haven’t grasped JS, see before you begin. I’d recommend to do slash commands instead of text-based commands as they’re more readable, performant and easily made intuitive.
In this case, the first 2 lines of your code should be replaced with
const { Client, GatewayIntentBits } = require("discord.js");
const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.MessageContent],
});
A base slash command bot won’t need any intents so it’s more performant. Add more intents when you need to.
3 Likes