API Reference
EmbedV2Builder
Builder for Discord Components V2 messages.
Overview
EmbedV2Builder builds Discord Components V2 messages — the new layout system that replaces classic embeds.
const embed = new EmbedV2Builder()
.container({ accentColor: 0x5865F2 })
.textDisplay("# Hello!")
.end()
.build()
await ctx.reply({ ...embed })
EmbedV2Builder is available globally — no import needed.EmbedV2Builder
Root builder — top-level components go here.
Methods
| Method | Returns | Description |
|---|---|---|
.container(opts?) | ContainerBuilder | Add a container |
.textDisplay(content) | this | Add a text display at root level |
.separator(opts?) | this | Add a separator at root level |
.mediaGallery(items) | this | Add a media gallery at root level |
.actionRow() | RootActionRowBuilder | Add an action row at root level |
.build() | object | Build and return the message payload |
.build()
Returns { flags: 32768, components: [...] } — spread it directly into your reply:
await ctx.reply({ ...embed.build() })
Throws if no components were added or if more than 25 components are present.
ContainerBuilder
Returned by .container(). Use .end() to return to EmbedV2Builder.
ContainerOptions
| Option | Type | Description |
|---|---|---|
accentColor | number | Left border color as a number |
spoiler | boolean | Blur content until clicked |
Methods
| Method | Returns | Description |
|---|---|---|
.textDisplay(content) | this | Add markdown text |
.separator(opts?) | this | Add a separator |
.mediaGallery(items) | this | Add a media gallery |
.file(url, spoiler?) | this | Add a file attachment |
.section() | SectionBuilder | Add a section |
.actionRow() | ActionRowBuilder | Add an action row |
.end() | EmbedV2Builder | Close the container and return to root |
If
theme.embedV2.footer.text is set in glyria.config.ts, a footer is automatically appended when .end() is called.SectionBuilder
Returned by .section(). Pairs text with an accessory. Use .end() to return to ContainerBuilder.
Methods
| Method | Returns | Description |
|---|---|---|
.textDisplay(content) | this | Add text (at least one required) |
.buttonAccessory(opts) | this | Set a button as accessory |
.thumbnailAccessory(url, desc?) | this | Set a thumbnail as accessory |
.end() | ContainerBuilder | Close the section |
A section requires at least one
.textDisplay() and exactly one accessory. Missing either throws an error.ActionRowBuilder
Returned by .actionRow() inside a container. Use .end() to return to ContainerBuilder.
Methods
| Method | Returns | Description |
|---|---|---|
.button(opts) | this | Add a button |
.end() | ContainerBuilder | Close the action row |
RootActionRowBuilder
Returned by .actionRow() at root level. Use .end() to return to EmbedV2Builder.
Methods
| Method | Returns | Description |
|---|---|---|
.button(opts) | this | Add a button |
.end() | EmbedV2Builder | Close the action row |
ButtonOptions
| Option | Type | Description |
|---|---|---|
label | string | Button text |
customId | string | Identifier for interaction — required for non-link buttons |
style | string | Button style |
url | string | URL — required for link style |
emoji | object | Button emoji (name, id, animated) |
disabled | boolean | Disable the button |
Button styles
| Style | Use case |
|---|---|
primary | Main action — requires customId |
secondary | Secondary action — requires customId |
success | Positive action — requires customId |
danger | Destructive action — requires customId |
link | External URL — requires url |
premium | Premium upsell |
SeparatorOptions
| Option | Type | Description |
|---|---|---|
divider | boolean | Show a visible divider line |
spacing | "small" | "large" | Spacing size |
MediaGalleryItem
| Option | Type | Description |
|---|---|---|
url | string | Image URL |
description | string | Caption (optional) |
spoiler | boolean | Blur until clicked (optional) |

