> For the complete documentation index, see [llms.txt](https://cjays-organization.gitbook.io/nexora.ts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cjays-organization.gitbook.io/nexora.ts/packages/core.md).

# @nexora.ts/core

Discord client, commands, events, message builders, DI container, event bus, cache, and scheduler.

```ts
import { Nexora, command, event, SlashCommand, EmbedBuilder } from '@nexora.ts/core';

const bot = new Nexora({ config, commandsPath: './commands/**/*.ts' });
await bot.start();
```

## Main exports

| Export                                                   | Purpose                                        |
| -------------------------------------------------------- | ---------------------------------------------- |
| `Nexora`                                                 | Bot lifecycle                                  |
| `command` / `event`                                      | Typed command / event helpers                  |
| `SlashCommand` / `BaseCommand`                           | Class-based slash commands                     |
| `SlashCommandGroup` / `ContextMenuCommand`               | Subcommands + context menus                    |
| `EventHandler`                                           | Class-based Discord events                     |
| `ButtonHandler` / `StringSelectHandler` / `ModalHandler` | Interaction handlers (`interactions/`)         |
| `Paginator` / `ConfirmDialog` / `ChoicePrompt`           | Prompt / UI helpers                            |
| `Service`                                                | Injectable service base (child logger)         |
| `Container` / `TOKENS`                                   | Dependency injection                           |
| `EventBus` / `FrameworkEvents`                           | Internal events (`COMMAND_EXECUTED`, …)        |
| `Cache` / `MemoryCacheAdapter`                           | Caching                                        |
| `Scheduler`                                              | Cron / interval / delayed jobs                 |
| Message builders                                         | Embeds, buttons, modals, Components V2 (below) |

## Builders

Fluent Discord payload builders with presets and short chains — shorter than raw discord.js, still `toJSON()`-compatible.

| Export                               | Purpose                                                                                               |
| ------------------------------------ | ----------------------------------------------------------------------------------------------------- |
| `EmbedBuilder` / `EmbedColor`        | Embeds + `success` / `error` / `warn` / `info` presets                                                |
| `ButtonBuilder` / `ActionRowBuilder` | Buttons and rows                                                                                      |
| `ModalBuilder` / `TextInputBuilder`  | Modals (auto action-row wrap)                                                                         |
| Select builders                      | `StringSelectBuilder`, `UserSelectBuilder`, …                                                         |
| `customId`                           | Optional `nexora:` / custom namespaces                                                                |
| Components V2                        | `text`, `container` / `MessageContainerBuilder`, `section`, `gallery`, `separator`, `ComponentsV2`, … |

`CommandContext.reply` resolves builders and can set `IS_COMPONENTS_V2` via `v2` or `ctx.componentsV2(…)`.

```ts
await ctx.embed(EmbedBuilder.info('Hello', 'From Nexora'));
await ctx.componentsV2(text('# Hi'));
```

Guides: [Builders](/nexora.ts/builders-and-ui/builders.md), [Components V2](/nexora.ts/builders-and-ui/components-v2.md).

## Command context & guards

`CommandContext` includes `reply`, `embed`, `componentsV2`, `defer`, `editReply`, `followUp`, plus `user`, `guild`, `member`, `channel`, and `interaction`.

Definition options: `guildOnly`, `adminOnly`, `permissions`, `cooldown` (ms).

See: [Commands](/nexora.ts/commands-and-interactions/commands.md), [Classes](/nexora.ts/classes/index.md), [Events](/nexora.ts/commands-and-interactions/events.md), [DI](/nexora.ts/advanced/dependency-injection.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://cjays-organization.gitbook.io/nexora.ts/packages/core.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
