API Reference

GlyriaCommand

The slash command builder.

Overview

GlyriaCommand is the builder used to define Discord slash commands. Every file in src/commands/ should export a GlyriaCommand instance as default.

export default new GlyriaCommand()
  .setName("ping")
  .setDescription("Pong!")
  .execute(async (ctx) => {
    await ctx.reply({ content: "Pong!" })
  })
GlyriaCommand is available globally — no import needed.

GlyriaCommand

Methods

MethodReturnsDescription
.setName(name)thisSet the command name
.setDescription(desc)thisSet the command description
.addStringOption(fn)thisAdd a string option
.addBooleanOption(fn)thisAdd a boolean option
.addIntegerOption(fn)thisAdd an integer option
.addNumberOption(fn)thisAdd a number option
.addUserOption(fn)thisAdd a user option
.addRoleOption(fn)thisAdd a role option
.addSubCommand(fn)thisAdd a subcommand
.addSubCommandGroup(fn)thisAdd a subcommand group
.execute(handler)thisSet the command handler

CommandOption

Passed as argument in every add*Option callback.

Methods

MethodReturnsDescription
.setName(name)thisSet the option name
.setDescription(desc)thisSet the option description
.setRequired(bool)thisMark the option as required

Example

.addStringOption((option) =>
  option
    .setName("reason")
    .setDescription("Reason of the ban")
    .setRequired(false)
)

GlyriaSubCommand

Passed as argument in .addSubCommand() callbacks.

Methods

MethodReturnsDescription
.setName(name)thisSet the subcommand name
.setDescription(desc)thisSet the subcommand description
.addStringOption(fn)thisAdd a string option
.addBooleanOption(fn)thisAdd a boolean option
.addIntegerOption(fn)thisAdd an integer option
.addNumberOption(fn)thisAdd a number option
.addUserOption(fn)thisAdd a user option
.addRoleOption(fn)thisAdd a role option
.execute(handler)thisSet the subcommand handler

Example

.addSubCommand((cmd) =>
  cmd
    .setName("ban")
    .setDescription("Ban a user")
    .addUserOption((option) =>
      option.setName("user").setDescription("User to ban").setRequired(true)
    )
    .execute(async (ctx) => {
      // handle ban
    })
)

GlyriaSubCommandGroup

Passed as argument in .addSubCommandGroup() callbacks.

Methods

MethodReturnsDescription
.setName(name)thisSet the group name
.setDescription(desc)thisSet the group description
.addSubCommand(fn)thisAdd a subcommand to the group

Example

.addSubCommandGroup((group) =>
  group
    .setName("config")
    .setDescription("Configuration commands")
    .addSubCommand((cmd) =>
      cmd
        .setName("logs")
        .setDescription("Configure logs")
        .addBooleanOption((option) =>
          option.setName("enabled").setDescription("Enable logs").setRequired(true)
        )
        .execute(async (ctx) => {
          // handle logs config
        })
    )
)
Copyright © 2026