Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

223
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda