API Reference

GlyriaUserCommand

The user context menu command builder.

Overview

GlyriaUserCommand is the builder used to define Discord user context menu commands. They appear when right-clicking on a user, under the Apps section.

export default new GlyriaUserCommand()
  .setName("View profile")
  .execute(async (ctx) => {
    const user = ctx.targetUser
    await ctx.reply({
      content: `Profile of ${user.username}`,
      flags: djs.MessageFlags.Ephemeral,
    })
  })
GlyriaUserCommand is available globally — no import needed.

GlyriaUserCommand

Methods

MethodReturnsDescription
.setName(name)thisSet the command name
.setPermissions(perms)thisRestrict the command to specific permissions
.setMetaData(meta)thisAttach custom metadata to the command
.execute(handler)thisSet the command handler
User context menu commands do not support descriptions, options, or subcommands — these are Discord API limitations.

.setPermissions()

Restricts the command to members with specific Discord permissions. Accepts a bigint, number, or string.

export default new GlyriaUserCommand()
  .setName("Warn user")
  .setPermissions(djs.PermissionsBitField.Flags.ModerateMembers)
  .execute(async (ctx) => {
    // only members with ModerateMembers permission can use this
  })

.setMetaData()

Attaches custom metadata to the command. Accepts any key-value object — Glyria stores it as-is and never interprets it.

export default new GlyriaUserCommand()
  .setName("View profile")
  .setMetaData({
    category: "utility",
    cooldown: 3000,
  })
  .execute(async (ctx) => {
    // your logic here
  })

Metadata is accessible at runtime via useCommands():

const commands = useCommands()
// [
//   { name: "View profile", description: "", meta: { category: "utility", cooldown: 3000 } },
// ]
useCommands() is available globally — no import needed. The registry is populated automatically when the bot starts.

.execute()

Sets the command handler. Receives a UserContextMenuCommandInteraction — the targeted user is available via ctx.targetUser.

export default new GlyriaUserCommand()
  .setName("View profile")
  .execute(async (ctx) => {
    const user = ctx.targetUser
    await ctx.reply({
      content: `Profile of ${user.username}`,
      flags: djs.MessageFlags.Ephemeral,
    })
  })
Copyright © 2026