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

262
Visualizações
deleting messages if a certain username said it
discordClient.on('messageCreate', async (message) => {

    async function dt() {

        if (message.content.includes('has been timed out for')){

            const user = message.content.split(" ")[1]
            const time = message.content.split(" ")[7]

            if (message.content === `** ${user} has been timed out for ${time} seconds.**`) {
                
                await message.channel.messages.fetch({
                    limit: 20 
                }).then((messages) => {
                    const msg = [];
                    messages.filter(m => m.author.username.toLowerCase() === user.toLowerCase()).forEach(message => msg.push(message))
                    message.channel.bulkDelete(msg).then(() => {
                        console.log('cleared messages')
                    });
                })
            }
    
          
        }
    }

    dt().catch(error)

    });

I made something that makes Twitch chat logs display on Discord, but I am now trying to make it that if a user has been timed out it deletes their messages. The code works fine but if someone typed it in chat it will consider it the same as a timeout so people in chat can delete messages on Discord. Is there any possible way to make it if a certain username did this then you apply the code using webhooks?

enter image description here

The one with the name User Timed Out I got it from /timeout on Twitch but with DancingPotato I just typed the same words as what it would do if it deleted the message without /timeout and it will clear the messages of both.

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