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

297
Visualizações
DiscordJS: Create Thread for bot's own message

I want the bot to create a Thread to it's own message, but I cant figure out how to do that. I've managed to make it create a Thread to the user's message, but thats about it.

client.on('messageCreate', async message => {
    if(message.author.bot) return;

    if(message.channel.id == config.suggestChannelID) {
        const suggestEmbed = new MessageEmbed()
            .setColor('#FEE75C')
            .setTitle(`${message.content}`)
            .setAuthor({
                name: `${message.member.displayName}`,
                iconURL: `[REDACTED]`,
                url: `[REDACTED]`
            })
            .setTimestamp()
            .setFooter({
                text: 'SuggestManager',
                iconURL: '[REDACTED]',
            });

        const discussThread = await message.startThread({
            name: 'name',
            autoArchiveDuration: 60,
            type: 'GUILD_PUBLIC_THREAD',
            reason: 'test'
        });

        await message.reply({embeds: [suggestEmbed]}).then(sentEmbed => {
            sentEmbed.react("👍")
            sentEmbed.react("👎")
        });

        message.delete(message.id);
    };
});
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

added const threadAuthor to save the original message author & replaced sentEmbed with function (message)

client.on('messageCreate', async message => {
    if(message.author.bot) return;

    if(message.channel.id == config.suggestChannelID) {
        //added this
        const threadAuthor = message.member.displayName;

        const suggestEmbed = new MessageEmbed()
            .setColor('#FEE75C')
            .setTitle(`${message.content}`)
            .setAuthor({
                name: `${message.member.displayName}`,
                iconURL: `[REDACTED]`,
                url: `[REDACTED]`
            })
            .setTimestamp()
            .setFooter({
                text: 'SuggestManager',
                iconURL: '[REDACTED]',
            });
        
        //changed this
        await message.reply({embeds: [suggestEmbed]}).then(function (message) {
            message.react("👍")
            message.react("👎")
            message.startThread({
                name: `${threadAuthor}-${message.createdTimestamp}`,
                autoArchiveDuration: 60,
                type: 'GUILD_PUBLIC_THREAD'
            });
        });

        message.delete(message.id);
    };
});
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