import { type Client } from "discord.js"; import { type BaseErrorHandler } from "./app.js"; import { type CustomClientOptions } from "./client.js"; export interface BootstrapOptions extends CustomClientOptions { /** * The caller module's `import.meta`. * Internally used for resolving file paths when dynamically loading modules. */ meta: ImportMeta; /** * The Discord bot token. * If omitted, bootstrap will attempt to use: * - `env.BOT_TOKEN` * - `process.env.BOT_TOKEN` */ token?: string; /** * A custom error handler that overrides the default one * configured by `ConstaticApp`. * * If provided, all global errors such as: * - `uncaughtException` * - `unhandledRejection` * * will be handled by this function. */ errorHandler?: BaseErrorHandler; /** * A hook executed before loading the modules. * Can be used to register services, prepare caches, * validate dependencies, or modify the client before initialization. */ beforeLoad?(client: Client): Promise; /** * Additional glob patterns used to load application modules. */ modules?: string[]; /** * Whether initialization logs should be displayed. * Defaults to `true`. */ loadLogs?: boolean; /** * Custom environment variables that may complement or override * values from `process.env`. */ env?: Record; } /** * * Bootstraps and initializes a Constatic application, creating the Discord client, * loading modules, registering events, and applying global error handlers. * * @example * import { bootstrap } from "@constatic/base"; * * await bootstrap({ meta: import.meta }); * * @example * import { env } from "#env"; * import { bootstrap } from "@constatic/base"; * * await bootstrap({ meta: import.meta, env }); */ export declare function bootstrap(options: BootstrapOptions): Promise<{ client: Client; imports: import("./modules.js").ModuleImported[]; }>;