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

98
Visualizações
Blacklist user IDs discord.js

How do I make my bot ignore users that I've added to a list? I'm new to this. I tried a few other ways I found on this site but I don't know how to add them to my code, I tried and failed.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Try this:

let blacklistUser = ['UserID1','UserID2']

if(!blacklistUser.includes(user.id)){
    ///your code
}

Here is a short explanation of the code:

let blacklistUser = ['UserID1','UserID2'] This is an array with the IDs of the blacklisted Users

if(!blacklistUser.includes(user.id)){}

The ! means "NOT" and blacklistUser.includes(user.id) is a funcion that checks if an array(blacklistUser) includes an object(user.id)

You should replace user.id with the needed variable. For example in a message event it would be: message.author.id.

I hope I could help you, to fix this problem.

about 4 years ago · Juan Pablo Isaza 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