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

Viewed 713

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)```
2 Answers

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)```

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)
Related