Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

806
Vistas
Discord Bot - Cannot access FLAGS from Intents

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)
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

It means you are using Discord.js v11 or older, where intents weren't there so to update it to v12 or newer you can:

  • Reinstall the module with npm uninstall discord.js and npm install discord.js.
  • Update it to the latest version with npm install discord.js@dev or a specific one with npm install discord.js@13.3.1.
  • Edit the version of the module in your package.json file.
about 4 years ago · Juan Pablo Isaza Denunciar

0

the first mistake I see is that you have to pass object to Client class, you did new Client(intents: [...]}). should be like new Client({ intents: [...] })

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda