const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildBans,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildPresences,
GatewayIntentBits.GuildInvites,
GatewayIntentBits.MessageContent,
GatewayIntentBits.DirectMessages,
],
});
module.exports = {
name: 'messageCreate',
async execute(message) {
try {
if(message.channel.type === ChannelType.DM) {
console.log(message.content)
} else {
console.log('not a dm')
}
}```
hello i did set the DirectMessages intent. but the dm messages are still not working. "not a dm" does get logged for guild messages
#dms to bot not received
3 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.
To receive direct message events on "messageCreate" with your bot, you will need:
• The DirectMessages gateway intent
• The Channel partial setting