Elpho LogoElpho

embed module

Build Discord embeds safely with a fluent builder. Always reply with toJSON() output.

Overview

embed() returns a builder with strongly limited, Discord-safe fields. Use it for cards, statuses, and dashboards. No raw object construction is needed.

API

  • setTitle(text), setDescription(text), setColor(hex).
  • addField(name, value) (inline auto-handled by renderer).
  • toJSON() → payload for ctx.reply.

Tips

  • Keep fields short; Discord truncates long text.
  • Hex colors should include # (e.g., #5865F2).
  • Multiple replies are allowed; you can send text then an embed.
Embeds must be string data only—no images or attachments via this builder.

Examples

javascript
const embed = use("embed");
function main() {
const card = embed();
card.setTitle("Server status");
card.setDescription("All systems operational.");
card.addField("Guild", ctx.guild ? ctx.guild.name : "DM");
card.setColor("#22c55e");
ctx.reply(card.toJSON());
}
javascript
const embed = use("embed");
function main() {
const card = embed();
card.setTitle("Profile");
card.addField("User", ctx.user.name);
card.addField("ID", ctx.user.id);
ctx.reply(card.toJSON());
}