Set Image for Forum Post

How can I set the image of a forum post when using components v2? - discord.js 14.19.3 - node 22.15.0
// Get modal inputs
const brewName = modalInteraction.fields.getTextInputValue('brewNameInput');
const brewLink = modalInteraction.fields.getTextInputValue('brewLinkInput');
const brewInfo = modalInteraction.fields.getTextInputValue('brewInfoInput');

// Create message components
const brewTitleComponent = new TextDisplayBuilder().setContent(`# ${brewName}`);
const brewAuthorComponent = new TextDisplayBuilder().setContent(`Brewer: ${interaction.user}`);
const brewLinkComponent = new TextDisplayBuilder().setContent(`**[View the brew here](${brewLink})**`);
const brewButtonComponent = new ButtonBuilder()
.setLabel('Open Brew')
.setStyle(ButtonStyle.Link)
.setURL(brewLink)
const sectionComponent = new SectionBuilder()
.addTextDisplayComponents(brewTitleComponent, brewAuthorComponent, brewLinkComponent)
.setButtonAccessory(brewButtonComponent)
const brewSeparatorComponent = new SeparatorBuilder().setSpacing(SeparatorSpacingSize.Large);
const brewInfoComponent = new TextDisplayBuilder().setContent(brewInfo);
const brewMentionComponent = new TextDisplayBuilder().setContent(`\nTime to get to work ${role}!`);

const containerComponent = new ContainerBuilder()
.addSectionComponents(sectionComponent)
.addSeparatorComponents(brewSeparatorComponent)
.addTextDisplayComponents(brewInfoComponent, brewMentionComponent)

// Create forum post
const forum = interaction.guild.channels.cache.get(brewChannelId);
forum.threads.create({
name: `${interaction.user.displayName} - ${brewName}`,
message: ({
flags: MessageFlags.IsComponentsV2,
components: [containerComponent]
})
});
// Get modal inputs
const brewName = modalInteraction.fields.getTextInputValue('brewNameInput');
const brewLink = modalInteraction.fields.getTextInputValue('brewLinkInput');
const brewInfo = modalInteraction.fields.getTextInputValue('brewInfoInput');

// Create message components
const brewTitleComponent = new TextDisplayBuilder().setContent(`# ${brewName}`);
const brewAuthorComponent = new TextDisplayBuilder().setContent(`Brewer: ${interaction.user}`);
const brewLinkComponent = new TextDisplayBuilder().setContent(`**[View the brew here](${brewLink})**`);
const brewButtonComponent = new ButtonBuilder()
.setLabel('Open Brew')
.setStyle(ButtonStyle.Link)
.setURL(brewLink)
const sectionComponent = new SectionBuilder()
.addTextDisplayComponents(brewTitleComponent, brewAuthorComponent, brewLinkComponent)
.setButtonAccessory(brewButtonComponent)
const brewSeparatorComponent = new SeparatorBuilder().setSpacing(SeparatorSpacingSize.Large);
const brewInfoComponent = new TextDisplayBuilder().setContent(brewInfo);
const brewMentionComponent = new TextDisplayBuilder().setContent(`\nTime to get to work ${role}!`);

const containerComponent = new ContainerBuilder()
.addSectionComponents(sectionComponent)
.addSeparatorComponents(brewSeparatorComponent)
.addTextDisplayComponents(brewInfoComponent, brewMentionComponent)

// Create forum post
const forum = interaction.guild.channels.cache.get(brewChannelId);
forum.threads.create({
name: `${interaction.user.displayName} - ${brewName}`,
message: ({
flags: MessageFlags.IsComponentsV2,
components: [containerComponent]
})
});
7 Replies
d.js toolkit
d.js toolkit4mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Wisecompany
WisecompanyOP4mo ago
Those don't seem to add the image to the forum post list.
No description
Wisecompany
WisecompanyOP4mo ago
☹️ So there's not a way to set the image directly, like you can upload an image manually when creating a forum post?
Wisecompany
WisecompanyOP4mo ago
Some examples of it not working with a thumbnail accessory and media gallery.
No description
No description
Wisecompany
WisecompanyOP4mo ago
And having the link that would normally display an embed with the image doesn't work either, for Components v2. They are URLs, not actual attachments. I'll give that a shot. Thanks for brainstorming with me!
dirtytin
dirtytin4mo ago
hi this will be fix soon
dirtytin
dirtytin4mo ago
GitHub
Webhook CV2 Attachments does not appear as Thread thumbnail · Issu...
Description Using discord webhook on a forum channel, creating a new thread with attached images for the first message should appear as the thread's thumbnail just like when sending embed as th...

Did you find this page helpful?