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

137
Visualizações
How can i make Spam check command mute after warning

I have been messing around with this spam check bot, and i would love to do it so it warns you after first 5 spam messages, and mutes you after 15. I tried to use else if command, but that didnt success that well :D

What should i do?

code:


function spamCheck(msg, set, time) {
    if (msg.member.roles.cache.find(role => role.name === 'Muted')) return

    let bool = false
    let user = { id: msg.author.id, time: Date.now(), times: 1 }

    for(let u of set) {
        if (isNaN(u.times)) u.times = 1

        if (u.id === msg.author.id) {
            bool = true

            if(u.times == 5) {
            msg.reply(`Please Do not spam!`)

    
            

            let muterole = msg.guild.roles.cache.find(role => role.name === 'Muted')
            if(!msg.member.roles.cache.has(muterole.id)) {
                msg.member.roles.add(muterole)

                setTimeout(() => {
                    msg.member.roles.remove(muterole)
                    set.delete(u)
                    msg.channel.send('**Unmuted**')
                }, 5000);
            }
            } else if ((Date.now() - u.time) <= time) {
                u.times++
                u.time = Date.now()
            }
        }
    }

    if (bool === false) {
        set.add(user)
    }
}

module.exports = { spamCheck }```
about 4 years ago · Juan Pablo Isaza
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