Eros
Eros

Reputation: 21

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

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

Upvotes: 1

Views: 3173

Answers (2)

Dinidu Samaranayake
Dinidu Samaranayake

Reputation: 19

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

Upvotes: 1

Androz2091
Androz2091

Reputation: 3005

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)

Upvotes: 0

Related Questions