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

246
Views
discord.js "TypeError: fn no es una función"

Entonces comencé a recibir este "Error de tipo: fn no es una función" después de agregar la declaración if-else al código

 module.exports = { name: `verify`, description: "Verification part of bot", execute (client, message, args){ let { channel, content, member } = message let timeout; const verified = message.guild.roles.cache.find(r => r.name === "Verified"); const notverified = message.guild.roles.cache.find(r => r.name === "Not Verified"); const rolemember = message.guild.roles.cache.find(r => r.name === "Member"); if(message.member.roles.cache.some(notverified)){ message.delete({timeout: 100}) message.member.roles.remove(notverified) message.member.roles.add(verified) message.member.roles.add(rolemember) message.channel.send(`${member}You have been successfully verified!`); message.channel.send(`Type to verify yourself!`); } else { message.delete({timeout: 100}) message.channel.send("You have already been verified!"); message.delete({timeout: 1000}) message.member.roles.add(role).catch(console.error); } } };

Ese es el codigo que tengo y mi error es

 if (fn(val, key, this)) ^ TypeError: fn is not a function

Gracias a cualquiera que pueda ayudarme a encontrar una solución para esto.

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Es porque .some() solo acepta una función de devolución de llamada, pero no se notverified que sea un rol o un valor falso.

En lugar de .some() , podría usar .has() para verificar si el usuario tiene el rol notverified :

 if(message.member.roles.cache.has(notverified.id)) {}
about 4 years ago · Santiago Trujillo 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!