Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

186
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda