messageCreate Event is not receiving DM messages

Hey, I'm trying to do something with my bot but I can't receive the messages that has been sent to the Bot DM's, And I have already enabled the Intents GatewayIntentBits.DirectMessages
3 Replies
d.js toolkit
d.js toolkit2mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
Midnight
Midnight2mo ago
- discord.js@14.14.1 Node: v18.19.1 The code is simple
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.DirectMessageReactions,
GatewayIntentBits.DirectMessageTyping
]
});

client.on('messageCreate', async (message) => {
if (message.channel.type === ChannelType.DM) {
if (message.author.bot || message.author.system) return;
console.log(message.author.id, message.content);
}
});
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.DirectMessageReactions,
GatewayIntentBits.DirectMessageTyping
]
});

client.on('messageCreate', async (message) => {
if (message.channel.type === ChannelType.DM) {
if (message.author.bot || message.author.system) return;
console.log(message.author.id, message.content);
}
});
d.js docs
d.js docs2mo ago
Tag suggestion for @Midnight: To receive direct message events on "messageCreate" with your bot, you will need: - The DirectMessages gateway intent - The Channel partial setting