Guide

Replyable Context

Send styled replies instantly with ctx.g.reply.

Overview

glyria.js wraps any Discord replyable object (interactions, messages) with a g property that exposes ready-to-use styled reply methods.

Instead of building an embed manually every time, you get one-liners:

await ctx.g.reply.success("User banned successfully!")
await ctx.g.reply.error("You don't have permission to do this.")

Usage

createReplyableContext is available in event handlers and wraps any replyable Discord object:

// src/events/messageCreate.ts
export default new GlyriaEvent()
    .setEvent(Events.MessageCreate)
    .setHandler(async (message) => {
        if (message.author.bot) return

        const ctx = createReplyableContext(message)

        if (message.content === "!ping") {
            await ctx.g.reply.success("Pong!")
        }
    })

Reply methods

All methods accept a string and return a promise.

MethodColorPrefix
.primary(content)#5865F2 (blurple)none
.secondary(content)#4F545C (grey)none
.success(content)#57F287 (green)
.warning(content)#FEE75C (yellow)⚠️
.error(content)#ED4245 (red)
.info(content)#5DADE2 (blue)ℹ️

Each method builds an Embed V2 automatically with the matching accent color.

Customizing colors

Override the default colors in glyria.config.ts:

export default defineConfig({
    theme: {
        embedV2: {
            primaryColor: "#7289DA",
            successColor: "#43B581",
            warningColor: "#FAA61A",
            errorColor: "#F04747",
            infoColor: "#00B0F4",
            secondaryColor: "#747F8D",
        }
    }
})
Colors are defined as hex strings — glyria.js converts them to numbers internally.

In slash commands

createReplyableContext works with any replyable — including slash command interactions:

export default new GlyriaCommand()
    .setName("ban")
    .setDescription("Ban a user")
    .addUserOption((option) =>
        option.setName("user").setDescription("User to ban").setRequired(true)
    )
    .execute(async (interaction) => {
        const ctx = createReplyableContext(interaction)

        try {
            // ... ban logic
            await ctx.g.reply.success("User banned successfully!")
        } catch {
            await ctx.g.reply.error("Failed to ban this user.")
        }
    })

In message events

export default new GlyriaEvent()
    .setEvent(Events.MessageCreate)
    .setHandler(async (message) => {
        if (message.author.bot) return

        const ctx = createReplyableContext(message)

        if (message.content.startsWith("!ping")) {
            await ctx.g.reply.success("Pong!")
        }
    })
Copyright © 2026