1

Module '"discord.js"' has no exported member 'Intents'.

My code is:

import dotenv from 'dotenv';

const bot = new Client({
    intents: [
        Intents.FLAGS.GUILDS,
        Intents.FLAGS.GUILD_MESSAGE
    ]
});

bot.on('ready', ()=>{
    console.log("ready")
})

bot.login(process.env.TOKEN)```
Eros
  • 21
  • 2
  • Does this answer your question? [Discord.js v13 code breaks when upgrading to v14](https://stackoverflow.com/questions/73028854/discord-js-v13-code-breaks-when-upgrading-to-v14) – Zsolt Meszaros Jul 20 '22 at 20:12

2 Answers2

1

Use IntentsBitField instead

    import DiscordJS, { IntentsBitField } from 'discord.js'
    import dotenv from 'dotenv';

const bot = new Client({
    intents: [
    IntentsBitField.Flags.Guilds,
    IntentsBitField.Flags.GuildMessages
]    });

bot.on('ready', ()=>{
    console.log("ready")
})

bot.login(process.env.TOKEN)```
0

You should use GatewayIntentBits now.

import dotenv from 'dotenv';
import { Client, GatewayIntentBits } from 'discord.js';

const bot = new Client({
    intents: [
        GatewayIntentBits.Flags.Guilds,
        GatewayIntentBits.Flags.GuildMessages
]
});

bot.on('ready', ()=>{
    console.log("ready")
})

bot.login(process.env.TOKEN)
Androz2091
  • 2,931
  • 1
  • 9
  • 26