Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

148
Vistas
How can i get to a bot to respond to dms

So working with discordjs and was wondering if it is possible to have my bot respond to commands sent in dms with the bot is there a way to listen to DMs? Example: user DMs the bot with !test and the bot would respond in DMs with success?

about 4 years ago · Juan Pablo Isaza
3 Respuestas
Responde la pregunta

0

Then when setting new Discord.Client() make sure to add the "CHANNEL" partial and the DIRECT_MESSAGES intent... You must also allow this intent in your developer portal else you will get an intents permissions error.

const client = new Discord.Client({
  partials: ["CHANNEL"],
  intents: [Discord.Intents.FLAGS.DIRECT_MESSAGES]
})

and then in the messageCreate listener this is how you listen for a DM.

if(command === "test" && message.channel.type === "DM"){
  message.channel.send("Success!")
}

this is checking if the channel the message is received in is a direct messaging channel, if not it'll return, else it will respond with with "Success!"

about 4 years ago · Juan Pablo Isaza Denunciar

0

You could do

if(message.channel.DMChannel) {
   message.author.send("Success")
}

I am not sure but it should work.

about 4 years ago · Juan Pablo Isaza Denunciar

0

if(message.channel.type == "DM"){ // if it's v12 just type change it to "dm"
// do sth

}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda