Skip to content

CIRCE / DOCUMENTATION

API index

Every public export in one line, linked to the page that documents it.

Documentation menu
On this page

Imports come from @sxnnyside/circe unless noted. The package ships TSDoc, so your editor shows exact types.

Definitions

Export Defines Page
defineCirceConfig circe.config.ts. Configuration
defineConfig · defineEnvConfig Validated environment. Environment
defineIntegration Lifecycle extension. Integrations
defineCommand Slash command. Commands
defineCommandGroup · defineSubcommand Nested subcommands. Command groups
defineUserCommand · defineMessageCommand Context menus. Context menus
defineEvent Gateway listener. Events
defineComponent Button or select menu. Components
defineModal Modal submit. Modals
defineMiddleware before and after hooks. Middleware
defineErrorBoundary Error and denial replies. Error boundary
defineLocalizationResolver ctx.t resolver. Localization

Guards and helpers

Export Purpose Page
guildOnly · hasPermission · invokerOnly Built-in guards. Guards
cooldown · MemoryCooldownStore Rate limit. Cooldown
createPaginator · MemoryPaginationStore Paged replies. Pagination
createTranslator · localizationContextOf · interpolate · resolveInteractionLocale Translation helpers. Localization
getCorrelationId · createLatencyAccumulator Observability. Health
detectRuntime Returns "bun" | "node" | "deno".
createCirce Programmatic app. below

Other entry points

Import Provides Page
@sxnnyside/circe/sqlite SqliteCooldownStore. Cooldown
@sxnnyside/circe/bun-sqlite Older Bun-only alias.
@sxnnyside/circe/testing Offline harness. Testing
@sxnnyside/circe/cli CLI entry, for Deno and programmatic use. CLI

Programmatic API

circe.config.ts compiles down to createCirce(options). Use it for custom entry points, tests or embedding. The app supports await using, which stops it when the scope ends.

import { createCirce } from "@sxnnyside/circe";

await using app = createCirce({
  config: { token: process.env.DISCORD_TOKEN!, clientId: process.env.DISCORD_CLIENT_ID! },
  intents: [],
});

await app.commands.load(new URL("./commands", import.meta.url));
await app.start();

app exposes client, commands, commandGroups, contextMenuCommands, events, components, modals, state, onStart, onStop and onReady.