Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

185
Views
DiscordJS V13 doesnt react to dms

I have this very basic code for a very basic discord bot

since the new discord.js version 13 you need to declare intents.

I tried doing that using the bitmap 32767 (basically declaring all intents), however the bot doesnt trigger the "messageCreate" event when a message is send in the dms it only works in servers.

All privileged gateway intents on the developer site have been set to true.

What am I missing?

const Discord = require("discord.js");
const allIntents = new Discord.Intents(32767);
const client = new Discord.Client({ intents: allIntents });


require("dotenv").config();
const botName = "Miku";

client.once("ready", () => {
    //gets executed once at the start of the bot
    console.log(botName + " is online!");
});


client.on("messageCreate", (message) => {
    console.log("got a message");
});


(async() => {
    //bot connects with Discord api
    client.login(process.env.TOKEN);
})();

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You cannot listen for events in the Direct Messages unless they are direct responses/replies/reactions to the initial message.

For example, you can send a message to new members and wait for a response:

client.on('guildMemberAdd', member =>{
    member.send("Welcome to the server!");

    message.awaitReactions(filter, { max: 1, time: 60000, errors: ['time'] })
    .then((collected) => {
       //Now, write your code here that handles the reactions. 
    });

but there is no way to listen for events within the Direct Messages. As in, client.on... will never fire because of a DM event.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!