Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

312
Visualizações
.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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda