You can now send Discord bot messages with Components V2, an opt-in layout system that treats text, images, files, and buttons as flexible components you can arrange in any order.
Set the adapter's contentFormat option to ComponentsV2 and cards render with native containers, sections, media galleries, separators, buttons, and string selects. Embeds remain the default, so existing bots work unchanged.
import { Actions, Button, Card, CardText, Image, LinkButton, Section } from "chat";import { createDiscordAdapter, DiscordContentFormat } from "@chat-adapter/discord";
const discord = createDiscordAdapter({ contentFormat: DiscordContentFormat.ComponentsV2,});
await thread.post( <Card title="Deployment ready" subtitle="Production build completed"> <Section> <CardText> **Version 2.4.0** is ready to promote.
Review the release notes, then choose an action below. </CardText> <Image url="https://example.com/deploy-preview.png" alt="Preview" /> </Section>
<Actions> <Button id="promote" style="primary">Promote</Button> <Button id="rollback" style="danger">Roll back</Button> <LinkButton url="https://example.com/deployments/123">View deployment</LinkButton> </Actions> </Card>);A card with sections, markdown, images, and actions rendered as Discord Components V2.
Individual sections can carry their own actions, markdown renders correctly inside components, and the adapter enforces Discord's platform limits for you, including the 40-component cap per message.
This release also includes several other Discord adapter improvements:
Rename threads: A new
setThreadTitle()method renames native Discord thread channels. Your bot needs the Manage Threads permission to use it.Ignore global pings: Bots running in gateway mode no longer treat
@everyoneand@hereannouncements as mentions. A newrespondToGlobalMentionsconfig option (defaultfalse) lets you opt back in. Direct mentions, role mentions, and replies to the bot are unaffected.Precise mention detection: Mentions of similarly named users no longer trigger false matches. A message with
@bot-devno longer counts as a bot tag.
Read the documentation to get started or browse the adapter directory.
Special thanks to community contributors DeanMauro, onmax, FarazPatankar, and sivchari for laying the groundwork for these improvements.