Examples

Embeds V2

Build rich Discord messages with the glyria.js Embed V2 builder.

glyria.js ships with a first-class builder for Discord's Components V2 — the new message layout system that replaces classic embeds.

Basic embed

const embed = new EmbedV2Builder()
  .container({ accentColor: 0x5865F2 })
    .textDisplay("# Hello!")
    .textDisplay("Welcome to the server.")
  .end()
  .build()

await ctx.reply({ ...embed })
Always spread the .build() output directly into your reply — not inside embeds: [].

Separator

Add visual spacing between sections:

new EmbedV2Builder()
  .container()
    .textDisplay("Section one")
    .separator({ spacing: "large" })
    .textDisplay("Section two")
  .end()
  .build()

Section with accessory

A section pairs text with a button or thumbnail on the right:

new EmbedV2Builder()
  .container()
    .section()
      .textDisplay("Choose your role")
      .buttonAccessory({ label: "Pick", customId: "role_picker", style: "primary" })
    .end()
  .end()
  .build()

Action row with buttons

new EmbedV2Builder()
  .container()
    .textDisplay("Are you sure?")
    .actionRow()
      .button({ label: "Confirm", customId: "confirm", style: "success" })
      .button({ label: "Cancel", customId: "cancel", style: "danger" })
    .end()
  .end()
  .build()

Display up to 10 images in a grid:

new EmbedV2Builder()
  .container()
    .textDisplay("Gallery")
    .mediaGallery([
      { url: "https://example.com/image1.png" },
      { url: "https://example.com/image2.png", description: "A caption" },
    ])
  .end()
  .build()

Multiple containers

You can chain multiple containers in a single message:

new EmbedV2Builder()
  .container({ accentColor: 0x57F287 })
    .textDisplay("✅ Action completed")
  .end()
  .separator()
  .container()
    .textDisplay("Here are the details...")
  .end()
  .build()

Button styles

StyleUse case
primaryMain action — requires customId
secondarySecondary action — requires customId
successPositive action — requires customId
dangerDestructive action — requires customId
linkExternal URL — requires url
Copyright © 2026