My discord is not allowing me to turn it on.
I checked versions, everything, but it is broken, again, again, and again…
Error:
intents: [Intents. FLAGS. GUILDS, Intents. FLAGS. GUILD_MEMBERS]
TypeError: Cannot read properties of undefined (reading 'FLAGS')
Versions:
Node js - 18.12.1
Discord.js - 14.8
Can you help please?
Code:
const Discord = require('discord.js');
const { Intents } = require('discord.js');
const client = new Discord.Client({
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MEMBERS]
});
const prefix = "!";
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
welcomeChannel = client.channels.cache.get('#######');
});
// Joining Code \\
client.on('guildMemberAdd', member => {
const embed = new Discord.MessageEmbed()
.setColor('#00ff00')
.setTitle('Welcome to the server! 🎉')
.setDescription(`Welcome to the official discord server, ${member}!`)
.setThumbnail(member.user.displayAvatarURL())
.setTimestamp();
welcomeChannel.send(embed); // Send the welcome message in the welcome channel
});
// Bot Login Token \\
client.login('#####');