Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

805
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!