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

410
Vistas
TypeError: Cannot read properties of undefined (reading 'cache')

i was coding my welcome message on my discord bot, but when someone enters in the server, console give me this error:

TypeError: Cannot read properties of undefined (reading 'cache')

here is my guildMemberAdd.js code:

const { MessageEmbed } = require('discord.js');

module.exports = {
name: "guildMemberAdd",
execute(member) {
    const MemberRole = member.guild.roles.cache.get('891716789879316540');
    member.roles.add(MemberRole);
    
    const WelcomeEmbed = new MessageEmbed()
    .setColor('RANDOM')
    .setAuthor('WELCOME', member.user.displayAvatarURL({dynamic: true}))
    .setDescription(`Welcome ${member} in our server!\n you are the number ${member.guild.memberCount}`)
    .setFooter(`${member.user.tag}`, member.user.displayAvatarURL({dynamic: true}))
    .setTimestamp();
    member.guild.channel.cache.get('768526997882142743').send({content: `${member}`, embeds: [WelcomeEmbed]});

    const LogEmbed = new MessageEmbed()
    .setColor('GREEN')
    .setDescription(`${member} came in our server`)
    .setTimestamp();

    member.guild.channel.cache.get('768526997882142743').send({embeds: [LogEmbed]});
    }
}

the strange thing is that on the 6th line it works fine, but in the 15th line and in the 22th doesn't works

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

0

Simple typo in channel:

member.guild.channel.cache.get('768526997882142743')

Should be:

member.guild.channels.cache.get('768526997882142743')
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