Skip to content
Advertisement

Intents keep giving me a error even though the intents code is a C&P from a working bot

I have tried this which is a copy and paste from another one of my bots

const client = new Discord.Client({
  intents: [
    Intents.FLAGS.GUILDS,
    Intents.FLAGS.GUILD_MESSAGES,
    Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
    Intents.FLAGS.GUILD_PRESENCES,
  ],
})

Error:

ReferenceError: Intents is not defined

Answer

Simply, you should define the Intents by doing this:

const { Client, Intents } = require('discord.js')

Edit: You dont need to use Discord on discord.js v13 since its not needed, instead do it like this:

const { Client, Intents } = require('discord.js')

const client = new Client({
  intents: [
    Intents.FLAGS.GUILDS,
    Intents.FLAGS.GUILD_MESSAGES,
    Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
    Intents.FLAGS.GUILD_PRESENCES,
  ],
})
Advertisement