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

359
Vistas
Cannot t read properties of unknown reading ('cache')

I've been trying to make a welcome embed for a Discord.js bot. My problem is, that I keep getting the error:

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

If I modify guild to guilds then I get this error:

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

I'm trying to display the amount of members in the guild (server). However, this error is preventing me. I've tried googling but I am unable to find any solutions, so I came here. I am using Discord.js v13.6 (the latest version).

The code is supposed to show an embed, when a member joins the guild. Here, of course, is my code:

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

module.exports = {
   name: 'guildMemberAdd',
   once: false,
   execute(member) {
       console.log('New member joined')
       const WelcomeChannel = '941373101277589564'
       const guild =  member.guilds.cache.get('940180806696058910')
       const channel = member.guilds.channels.cache.get(WelcomeChannel)
       let welcomeEmbed = new MessageEmbed()
            .setDescription(`Welcome <@${member.user.id}> to the **Monocle Games** Discord server.\n Member Count: ${guild.memberCount} `)
            .setTimestamp()

        welcomeEmbed.setAuthor({
            name: '**WELCOME**',
            iconURL: member.user.avatarURL()
        })
        channel.send({embeds: [welcomeEmbed]})
   }
}

It is part of an event handler, however that is not related to the problem. My first thought was that the way I was getting the guild was outdated, however, I do believe this is the latest version, so what am I doing wrong?

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

0

Member has guild property:

const guild = member.guild
const channel = guild.channels.cache.get(WelcomeChannel)
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