I’m working on a Discord bot using discord.js version 14 and running into an issue. The bot works perfectly fine in my server - it picks up all messages and responds correctly. But when I try to send a private message directly to the bot, nothing happens at all. The messageCreate event doesn’t even trigger for DMs.
const bot = new Client({intents: [
GatewayIntentBits.DirectMessages,
GatewayIntentBits.DirectMessageReactions,
GatewayIntentBits.DirectMessageTyping,
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
]});
bot.on('ready', () => {
console.log(`Bot is online as ${bot.user.tag}!`);
});
bot.on('messageCreate', (msg) => {
console.log('New message:', msg.content); // only shows server messages
});
I have all the right intents enabled as far as I can tell. Is there a different event for handling private messages in v14? I can’t seem to find updated documentation about this.
Check if your bot has message content intent enabled in the developer portal, not just your code. Mine failed silently because I forgot to toggle it there. Also try console.log('dm received:', msg.author.tag) inside if (!msg.guild) - helped me catch DMs that were coming through but getting ignored by my logic.
I ran into this exact issue recently - super frustrating. Your intent settings look fine, but here’s the catch: the bot can only receive DMs from users who share a server with it. That’s just how Discord works, and it won’t trigger messageCreate without a mutual server. Test it with an account that’s in a server with your bot first. Also worth checking your bot’s DM settings in the developer portal - they might be disabled, which could mess things up compared to v13.
Had this exact problem months ago and wasted hours debugging it. Yeah, the mutual server thing is real, but here’s what got me - double-check you’re logged into the right Discord account when testing. I kept switching between my main and alt accounts and forgetting which one was actually in the server with my bot. The messageCreate event works fine for DMs in v14, nothing changed from v13. What helped me debug was throwing in console.log(msg.guild) to see if messages came from guilds or DMs (null for DMs). Also make sure your bot user has DMs enabled in privacy settings, not just the app settings.
Hit the same issue building internal tools. Yeah, mutual servers are required, but there’s more to it.
Your code’s fine - Discord’s DM handling just sucks even when everything’s setup right. I got tired of fighting it and automated the whole thing through Latenode instead.
I built workflows that handle server and DM interactions in one system. Latenode hits Discord’s API directly and processes messages way more reliably than standard event listeners. You can route DM responses, track user states, and add fallbacks when Discord’s DM system craps out.
Workflows also make adding features dead simple - user databases, response templates, integrations with other services. No more debugging intents or wondering why events randomly die.
Check it out: https://latenode.com
Heads up - I got burned by this migrating from v13 to v14. Even with correct intents, you need partials for DM channels since they’re not cached by default. Add this to your client:
const bot = new Client({
intents: [...your intents],
partials: [Partials.Channel]
});
Without it, DM channels won’t initialize properly when users first message your bot. Your messageCreate event just silently fails. The partial forces the channel to get fetched and cached. This wasn’t documented well in the v14 transition - I only caught it after digging through my error logs.