nexcord-hello

v0.0.1

Example Nexcord slash command that registers /hello and replies with an ephemeral greeting — a good starting point for building your own commands.

_ _signor_p_ · 0 downloads · Updated 7/13/2026
nexrecipenexcorddiscorddiscord.jsslash-commandhello-worldexampletypescript
xnex install nexcord-hello GitHub repo

Nexcord Hello Recipe

A minimal starter recipe that adds a single /hello slash command to a Nexcord bot. Use it as a template for new commands, or as a quick check that command registration and interaction handling are wired up correctly.

Files

FileInstalled to
src/commands/hello.command.tssrc/commands/
recipes/nexcord-hello/README.mdrecipes/nexcord-hello/

This mapping comes from recipe.json, which Nexcord's recipe tooling reads to know where to copy each file.

Requirements

  • @nexcord/core — provides BaseSlashCommand and the @SlashCommand decorator
  • discord.js ^14.26.4
  • reflect-metadata — needed for Nexcord's decorator metadata; import it once near your bot's entry point
  • TypeScript ^6.0.3, with experimentalDecorators (and emitDecoratorMetadata) enabled in tsconfig.json

How it works

ts
@SlashCommand('hello', 'hello command')
class HelloCommand implements BaseSlashCommand {
    build(b: SlashCommandBuilder) {
        return b
    }
    handler(i: CommandInteraction): void | Promise<void> {
        i.reply({ content: 'Hello!!', flags: 'Ephemeral' })
    }
}
  • @SlashCommand('hello', 'hello command') registers the command's name and description with Nexcord.
  • build(b) receives the SlashCommandBuilder Nexcord already configured from that name/description, and returns it unchanged — no extra options, subcommands, or permissions are added.
  • handler(i) runs when someone uses /hello. It replies with Hello!! as an ephemeral message, so only the user who ran the command can see it.

Usage

  1. Copy the recipe's files to the destinations listed above (or apply the recipe with your project's tooling, if you have a recipe installer set up).
  2. Make sure hello.command.ts ends up wherever Nexcord scans for commands (src/commands).
  3. Start the bot:
    bash
    bun run bot
  4. In a server the bot is in, run /hello — you'll get back a private Hello!! reply.

Customizing

  • Change the reply text — edit the string passed to i.reply(...).
  • Make the reply public — remove the flags: 'Ephemeral' option.
  • Add options or subcommands — extend build(b) with .addStringOption(), .addSubcommand(), etc. before returning b.
  • Rename the command — change the first argument of @SlashCommand(...), and keep the file/class name in sync for readability.