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);
};
});
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);
};
});