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

199
Views
cómo verificar si un mensaje tiene un ping discord.js

Sé que puedes usar:

 client.on('messageCreate', msg => { if(msg.content.includes("<@") && msg.content.includes(">")){ //some code } })

pero este método no es realmente el mejor. ¿Hay una mejor manera de verificar si hay pings en un mensaje de discordia?

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

0

Si desea verificar si hay menciones en un mensaje, puede obtener las menciones en el mensaje y verificar el tamaño de ellas usando:

 if (message.mentions.users.size !== 0) {}

Luego puede reemplazar los .users con .channels para verificar si hubo canales mencionados y .roles para verificar si se mencionó algún rol

about 4 years ago · Juan Pablo Isaza Report

0

Puede usar message.mentions.members.first() para obtener el primer usuario al que se le hizo ping. Entonces, usando tu ejemplo:

 if(message.mentions.members.first()){ //some code }
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!