Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

146
Views
Problema de Discord Bot - TypeError: No se pueden leer las propiedades de nulo (leyendo 'id')

Recibo el siguiente error: TypeError: No se pueden leer las propiedades de nulo (leyendo 'id') en /index.js:144:31. Mi código index.js está a continuación:

 if(interaction.customId == 'generateCode') { // defer await interaction.deferReply({ ephemeral: true }); // already generated? data = JSON.parse(fs.readFileSync(`./system/index.json`)); *This is row 144, user.id is the issue* if(data.filter(t => t.id == interaction.user.id)[0]) { embed = new MessageEmbed() .setColor('DARK_BLUE') .setAuthor({ name: interaction.user.tag, iconURL: interaction.user.displayAvatarURL() }) .setDescription("`"+data.filter(t => t.id == interaction.user.id)[0].code+"`") await interaction.editReply({ embeds: [embed] }); return }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

El error le dice que su objeto de usuario es nulo. Parece que los data = JSON.parse(fs.readFileSync()) no están extrayendo el archivo.

Basado en esto: JSON.parse(fs.readFileSync()) que devuelve un búfer: una cadena de números readFileSync devuelve un búfer si no agrega una codificación.

 data = JSON.parse(fs.readFileSync(`./system/index.json`, 'utf8'))
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!