Yet another Fluxer bot built with TypeScript and Bun
1import type { Client, Message } from "@fluxerjs/core";
2import type { ArgSchema, ParsedArgs } from "@/args";
3
4export type { ParsedArgs };
5
6/** Injected into every command's execute() call by the registry. */
7export interface BotContext {
8 client: Client;
9}
10
11export interface ICommand<TArgs extends ArgSchema = Record<string, never>> {
12 /**
13 * Declare your arg schema here. The registry reads this to parse and
14 * validate raw string args before calling execute().
15 *
16 * Entries can be:
17 * - Our built-in helpers: arg.string(), arg.number(), arg.boolean(), arg.rest()
18 * - Any Standard Schema compatible schema (Zod, Valibot, ArkType, etc.) — required by default
19 * - arg.optional(zodSchema) — to make an external schema optional
20 *
21 * Omit entirely for commands that take no args.
22 */
23 readonly args?: TArgs;
24
25 execute(ctx: BotContext, message: Message, args: ParsedArgs<TArgs>): Promise<void>;
26}
27
28export type CommandCtor = new () => ICommand<ArgSchema>;