fix(discord): add Partials.Channel to gateway client for DM support#128
fix(discord): add Partials.Channel to gateway client for DM support#128haydenbleasel merged 4 commits intovercel:mainfrom
Conversation
The gateway client requests DirectMessages intent but doesn't include `Partials.Channel`, which discord.js requires to emit DM events. Without it, all DM `MessageCreate` events are silently dropped. Signed-off-by: TRACTION <19631364+iamtraction@users.noreply.github.com>
|
@iamtraction is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
|
Investigated this and can confirm the fix is correct. Here's the evidence: The mechanism (discord.js v14 source)
const channel = this.getChannel({ id: data.channel_id, ... });
if (channel) {
// ... emit Events.MessageCreate
}
getPayload(data, manager, id, partialType, cache) {
return this.client.options.partials.includes(partialType)
? manager._add(data, cache) // Partials.Channel enabled → construct channel
: manager.cache.get(id); // Not enabled → lookup cache (returns undefined for DMs)
}Discord's API stopped sending Maintainer confirmation
TL;DRBoth |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
|
Thanks @iamtraction great catch 🙏 |
The Discord adapter's
runGatewayListenercreates a discord.jsClientwithGatewayIntentBits.DirectMessagesbut withoutPartials.Channel. discord.js requires this partial to receive DM events. Without it, DMMessageCreateevents are silently dropped.