i am trying to create my own discord bot and it gives me that error I don't know what to do it's giving me that error
can you help me, please?
my version of discord.js is 14.0.3 and my node.js version is 18.5.0
I tried everything that I could even your tips and I can't do this so do you have any tips to please help me because I promised a friend I would help him
I GOTTA SAY THAT ITS THE FIRST TIME THAT IT HAPPENED TO ME AND BEFORE THAT I CREATED 2 BOTS
CodePudding user response:
In discord.js
v14, Intents
have been replaced by GatewayIntentBits
. Therefore, the correct way for creating the client is like this:
const { Client, GatewayIntentBits } = require('discord.js')
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
// ...
]
})
For more information, you can go here => Discord.js v13 code breaks when upgrading to v14
CodePudding user response:
They changed how this works in discord.js v14. Example from the official updating guide:
const { Client, Intents } = require('discord.js'); // old
const { Client, GatewayIntentBits, Partials } = require('discord.js'); // new
const client = new Client({ intents: [Intents.FLAGS.GUILDS], partials: ['CHANNEL'] }); // old
const client = new Client({ intents: [GatewayIntentBits.Guilds], partials: [Partials.Channel] }); // new