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

415
Vistas
discord.js 13 | How do i DM a member a message when they join the server?

I've been trying to find a way to DM a member a welcome message when they join the server. I have a way to DM the member, but I can't find a way to trigger it when someone joins. here's the code that will DM the member a message: message.author.send('message content here')

Here's the code that doesn't seem to work:

bot.on("guildMemberAdd", member => {
    log("new member joined the server")
    member.send("Welcome to the server!");
});

Note: I have a function called log, this is not what's causing the issue (i think), it's declared before this

Thanks for any help :)

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Your code isn't working, most likely, because you haven't requested the GUILD_MEMBERS intent which is necessary for the guildMemberAdd event.

Here is a simple example on how to request the GUILD_MEMBERS intent.

const { Client, Intents } = require("discord.js");
const bot = new Client({
    intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MEMBERS],
});

Make sure you have also enabled it in your bot's settings. (Bot -> Privileged Gateway Intents -> SERVER MEMBERS INTENT)

about 4 years ago · Santiago Trujillo 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