how to i listen for dm messages

client.on(Events.MessageCreate, async (interaction) => {
console.log(interaction)
});
client.on(Events.MessageCreate, async (interaction) => {
console.log(interaction)
});
this doesnt seem to be getting called in dms i have the intents dms and message content
8 Replies
d.js toolkit
d.js toolkit5d 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
Duckie
DuckieOP5d ago
node verison is v20.19.0 and discordjs is @14.18.0
Inky
Inky5d ago
Do you also have the channel partial?
Duckie
DuckieOP5d ago
no wdym
d.js docs
d.js docs5d ago
To receive direct message events on "messageCreate" with your bot, you will need: - The DirectMessages gateway intent - The Channel partial setting
Duckie
DuckieOP5d ago
/home/jetbrains/Projects/DiscordBot/index.ts:20 Partials.Channel ^ ReferenceError: Partials is not defined at sendEmbeds (/home/jetbrains/Projects/DiscordBot/index.ts:20:9) at Object.<anonymous> (/home/jetbrains/Projects/DiscordBot/index.ts:54:2) at Module._compile (node:internal/modules/cjs/loader:1529:14) at Object.transformer (/home/jetbrains/.cache/JetBrains/RemoteDev/dist/693580c309f24_WebStorm-243.23654.44/plugins/nodeJS/js/ts-file-loader/node_modules/tsx/dist/register-DfubRCxM.cjs:2:823) at Module.load (node:internal/modules/cjs/loader:1275:32) at Module._load (node:internal/modules/cjs/loader:1096:12) at cjsLoader (node:internal/modules/esm/translators:298:15) at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:240:7) at ModuleJob.run (node:internal/modules/esm/module_job:263:25) at async ModuleLoader.import (node:internal/modules/esm/loader:540:24) Node.js v20.19.0
Inky
Inky5d ago
Did you import Partials?
Duckie
DuckieOP5d ago
oh thanks it works now

Did you find this page helpful?