Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

807
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda