Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

227
Vistas
How to detect how many pings are in a message DISCORD JS?

How can I detect how many pings are in a message? I'm not sure where to start. I'm trying to create a anti-raid bot and I want to detect if someone pings 5 people in one message

about 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

MessageMentions#user returns a discord.js collection, you can get the length of the collection by simply using message.mentions.users.size, this works with any mentions like

  • .roles
  • .members
  • .channels

and you can just detect using

if(message.mentions.members.size > n) {
  message.delete();
}
about 4 years ago · Santiago Trujillo Denunciar

0

Simple code that counts unique user mentions in the message.

let count = 0;
for(const user of msg.mentions.users) {
    count++;
}
if(count>4) {
    msg.delete();
}
about 4 years ago · Santiago Trujillo Denunciar

0

You can see how many people were pinged using message.mentions.users Like the following:

Array.from(message.mentions.users).length

It may be 1 over what you need, because Javascript strings start at 0. If so, just add a -1.

Array.from(message.mentions.users).length-1

And please, search this stuff up. I was able to find this on the Discord.js documentation in a matter of seconds.

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda