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

150
Vistas
Cannot read property 'guild' of undefined

Hey,

I want to make a welcome system and it works in the index. But I have a folder events in which it is not working anymore... Of course, I have modified the code a bit.

I have this code:

const Discord = require("discord.js")
  
module.exports = async(client, message, member, interaction) => {

  function welcome(member) {
  const params = new URLSearchParams({
    avatar: member.displayAvatarURL({
      format: 'png'
    }),
    memcount: member.guild.memberCount,
    discrim: member.user.discriminator,
    name: member.user.username,
    bg: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRftGIBXNXQV02kJRDFaX9hZJ_JsG9iU74WfA&usqp=CAU",
header: "VÍTEJ!",
membertext: "{count}tý uživatel",
apikey: process.env.welcomeAPIKey
  });

   
  const image = 'https://api.badboy.is-a.dev/image/welcomecard?' + params
  return image;
}
//client.on("guildMemberAdd", member => {
    member.guild.channels.cache.get("969631692841185410").send({
        embeds: [new Discord.MessageEmbed().setImage("attachment://welcome.png")],
        files: [new Discord.MessageAttachment(welcome(member), "attachment://welcome.png")]
    })

}

But also this error: TypeError: Cannot read property 'guild' of undefined

Can someone please help me?

about 4 years ago · Juan Pablo Isaza
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