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

309
Vistas
.TypeError: Cannot read property 'content' of undefined

This is really confusing for me

Here is the error

TypeError: Cannot read property 'content' of undefined

And Here is the code

client.on("messageDelete", async (member, message) => {
      let aud = db.get(`auditchannel_${member.guild.id}`);
      if(aud === null) {
        return;
      }
      client.channels.cache.get(aud).send(`<@${member.member.user.id}>'s message was deleted in <#${member.channel.id}>`)
      console.log(message.content())
    })
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

messageDelete has only one argument see the example so message variable is undefined and you are trying to read 'content' of "message".

about 4 years ago · Juan Pablo Isaza Denunciar

0

Undefined means that a variable has been declared but has not yet been assigned a value. This particular error is probably easiest to understand from the perspective of undefined, since undefined is not considered an object type at all (but its own undefined type instead), and properties can only belong to objects within JavaScript.

In the above code, when you get undefined error , you need to make sure that whichever variables throws undefined error, is assigned a value to it.

function myFunc(inVar) {
   if (inVar === undefined) {
        console.log(inVar.not)
  }
  return inVar;
}
var testVar=99;//initialize here
console.log(myFunc(testVar));

In the above JavaScript you can the variable testVar is initialized the value of 99. So the script run successfully.

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