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 toolkit9mo 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
MidnightOP9mo ago
- [email protected] 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 docs9mo 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
Want results from more Discord servers?
Add your server