const Discord = require("discord.js");
const { GatewayIntentBits, Client } = Discord;
const client = new Client({
intents: [
GatewayIntentBits.DirectMessages
GatewayIntentBits.MessageContent
], partials: [
'CHANNEL', // Required to receive DMs
'MESSAGE'
]
});
client.on("messageCreate", async(message) => {
console.log("received message");
if(!message.guild) {
console.log("this is a dm");
}
});
#the bot is not receiving dms
6 messages · Page 1 of 1 (latest)
• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.
[email protected] and node v18.15.0
(You need to use Partials.Message, Partials.Channel not strings)
Tag suggestion for @fleet pendant:
To receive direct message events on "messageCreate" with your bot, you will need:
• The DirectMessages gateway intent
• The Channel partial setting
Popular Topics: Partial Structures