I started coding personal bot. I'm getting an error
TypeError: Cannot read properties of undefined (reading 'FLAGS')
I'm assuming it can't access FLAGS. I don't understand why because I have installed the latest node and discord.js. I allowed all premission for 'Privileged Gateway Intents' for my Bot on my personal account on Discord Developer Portal. I followed this tutorial: https://www.youtube.com/watch?v=Qc9uPgGmQ7I
This is my code so far:
require("dotenv").config();
const { Client, Intents } = require("discord.js")
const client = new Client({
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES
]
});
client.on("ready", () => {
console.log(`Logged in as ${client.user.tag}!`);
});
client.on("interactionCreate", async interaction => {
if (!interaction.isCommand()) return;
if (interaction.commandName === "ping") {
await interaction.reply("Pong!");
}
});
client.login(process.env.SPELL_BOT_TOKEN)