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

180
Views
TypeError: no se pueden leer las propiedades de undefined (leyendo 'catch')

Estoy tratando de obtener un canal con una identificación o mención, el código en sí funciona, pero cuando el usuario proporciona una identificación incorrecta, dice: TypeError: no se pueden leer las propiedades de undefined (leyendo 'catch')

¿Alguien puede ayudarme?

Intenté esto:

 message.guild.channels.cache.find(channel => channel.id == args[0]).catch(err => {});

Y esto:

 message.guild.channels.cache.get(args[0]).catch(err => {});

Estas dos cosas me dan error.

Aquí está el código:

 if (args[0].startsWith("<#")) channel = message.mentions.channels.first(); else channel = message.guild.channels.cache.get(args[0]).catch(err => { //do stuff })
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

De acuerdo, descubrí la respuesta con la ayuda de @JeremyThille: `Cuando la identificación es incorrecta, intenta anular.catch()

Eliminé catch del código y agregué

 if(!channel) //do stuff

Gracias @JeremyThille

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!