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

206
Visualizações
Why is my message collectors collecting the same message?

So I'm trying to make a modmail system but for some reason the channel collector is collecting the same messsage. Any help would be great!

const discord = require("discord.js")
module.exports = {
    name: 'modmail',
    aliases: ['mail'],
    execute: async (client, message, args) => {
        const mes = await message.channel.send("I have sent you a dm.")
    const config = require("/home/runner/Bot2/Handlers/config.json")
        message.author.send("Start typing to chat with the moderators.")
            .then(async (msg) => {
                const filter = m => !m.author.bot;
                const collector = await msg.channel.createMessageCollector({
                    filter,
                });
                const channel = await message.guild.channels.create(`${message.author.username}s-modmail`, {
                    permissionOverwrites: [{
                        id: config.mainrole,
                        deny: ["VIEW_CHANNEL"],
                    }, ],
                })
                collector.on("collect", m => {
                    channel.send(`${m.author.tag}: ${m.content}`)
                    const filter = mm => !mm.author.bot;
                    const channelcollect = channel.createMessageCollector({
                        filter,
                        max: 1,
                    });
                    if (m.content == "?mmclose") {
                        m.reply("Modmail will be closing.")
                        collector.stop()
                    }
                    channelcollect.on("collect", async mm => {
                        if (mm.content == "?mmclose") {
                            return channel.delete()
                        }
                        m.author.send(`${mm.author.tag}: ${mm.content}`)
                        console.log(mm.content)
                    })
                })

            })
         .catch(error => {
            mes.delete()
            message.reply("Something went wrong. Make sure your dms are open. If this happens if when your dms are on then dm !Kweeper#8053")
        })
    }
}

The mod mail channel

The modmail dm

I don't know why this happen because I've set the max messages to 1 and the dm collector max to 1 but it breaks the code.

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