messageCreate not triggered on DM in main
See original GitHub issueWhich package is this bug report for?
discord.js
Issue description
- Listen in messageCreate
- provide proper intents (DirectMessages from gateway bits)
- send message to bot from private account
- event not triggered
Code sample
import { Client, GatewayIntentBits } from 'discord.js';
const client = new Client({
'intents': [
GatewayIntentBits.DirectMessages,
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildPresences,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildBans,
GatewayIntentBits.GuildMessages
],
'partials': ['CHANNEL']
});
process.on('uncaughtException', (err) => {
console.log('General error:', err.message);
console.log(err);
});
client.on('messageCreate', async (m) => {
console.log(m);
});
client.login('TOKEN');
Package version
14.0.0-dev.1647259751.2297c2b with https://github.com/discordjs/discord.js/pull/7649 apply’d
Node.js version
v16.14.2
Operating system
Debian
Priority this issue should have
Medium (should be fixed soon)
Which partials do you have configured?
Channel
Which gateway intents are you subscribing to?
Guilds, GuildMembers, GuildBans, GuildPresences, GuildMessages, DirectMessages
I have tested this issue on a development release
No response
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Event messageCreate not firing/emitting when I send a DM to ...
The bot has to send at least one DM to the user first. Then the messageCreate is firing as usual. Not sure if...
Read more >Discord.js v14 - Listening and Handling Events - YouTube
Join my Discord for more help: https://discord.gg/Gd5fAEJDQDCode: https://github.com/stuyy/djs-v14-tutorialSupport the Channel:Become a ...
Read more >Gateway Intents - discord.js Guide
If you do not specify intents, discord.js will throw an error. ... to receive messages ( MESSAGE_CREATE - "messageCreate" in discord.js), ...
Read more >Gateway - Discord Developer Portal
You need to cache the most recent non-null s value for heartbeats, ... The bot owner(s) will receive a system DM and email...
Read more >How to Make a Discord Bot: An Overview and Tutorial - Toptal
There are two main reasons. Querying the REST API to get user information every time a Message Create event is received, for example,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Unfortunately, that’s not how one applies partials. Import the partial like so:
Aha, thats changed too? Thanks.
Works. Wow, I’ve found all bit changes, but this one overlooked. Thanks for the amazingly quick reply. 😃
For future reference, this is how DM channels work under v14;