#the bot is not receiving dms

6 messages · Page 1 of 1 (latest)

fleet pendant
#
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");
  }
});
frozen canyon
#

• 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.

fleet pendant
fleet bobcatBOT
#

Suggestion for @fleet pendant:
guide Popular Topics: Partial Structures
read more

nimble kindle
#

(You need to use Partials.Message, Partials.Channel not strings)

fleet bobcatBOT
#

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