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

239
Views
TypeError: no se pueden leer las propiedades de undefined (leyendo 'agregar')

He estado atascado en esto durante mucho tiempo y no puedo entender por qué aparece el error.

 async function verify(i) { try { var g = await client.guilds.cache.get("943025185295044608"); var r = await g.roles.cache.get("943202823217221652"); var mem = await client.users.cache.get(i) mem.roles.add(r); client.channels.cache.get("944841210462367794").send(`${mem} was verified`) } catch (e) { client.channels.cache.get("944841210462367794").send(`${mem} was not verified`) console.log(g) console.log(r) console.log(mem) console.log(e) } }

Cuando hago console.log aparece la variable definida. He intentado hacer await pero eso no funciona. También estoy trabajando en discord.js v12

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Gracias a Ivar obtuve mi respuesta mem is a User . Los usuarios no tienen roles. Los miembros del gremio tienen roles. Así que cambié client.users.cache.get(i) a g.members.cache.get(i)

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!