Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

290
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
ยฉ 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!