My bot don't receive direct message

const { config } = require('dotenv');
config();

const { Client, GatewayIntentBits, ComponentType, ButtonStyle, Events } = require('discord.js');

const client = new Client({ intents: [GatewayIntentBits.DirectMessages] });

client.on(Events.ClientReady, () => {
console.log('[INFO] Bot is ready!');
});

client.on(Events.MessageCreate, async message => {
if (message.inGuild()) {
return;
}

console.log("Hello World");
});

client.login(process.env.MODMAIL_TOKEN);
const { config } = require('dotenv');
config();

const { Client, GatewayIntentBits, ComponentType, ButtonStyle, Events } = require('discord.js');

const client = new Client({ intents: [GatewayIntentBits.DirectMessages] });

client.on(Events.ClientReady, () => {
console.log('[INFO] Bot is ready!');
});

client.on(Events.MessageCreate, async message => {
if (message.inGuild()) {
return;
}

console.log("Hello World");
});

client.login(process.env.MODMAIL_TOKEN);
There is no log... I don't understand what I am missing...
3 Replies
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
d.js docs
d.js docs15mo ago
Tag suggestion for @apokalypt: To receive direct message events on "messageCreate" with your bot, you will need: • The DirectMessages gateway intent • The Channel partial setting
Apokalypt
Apokalypt15mo ago
😭 Thanks
Want results from more Discord servers?
Add your server
More Posts