@hank.chat/types
Version:
63 lines (62 loc) • 2.11 kB
TypeScript
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { AccessCheckChain } from "../access_check/access_check";
import { Argument } from "./argument";
/** Plugin commands. */
export interface Command {
/** Command name. */
name: string;
/** Command description. */
description: string;
/** Command author. */
author?: string | undefined;
/**
* A version string for the command. Should follow semver.
*
* @see: https://semver.org/
*/
version?: string | undefined;
/** Command aliases. */
aliases: string[];
/** Command arguments. */
arguments: Argument[];
/** Command subcommands. */
subcommands: Command[];
/**
* Access checks
*
* This command can optionally be gated by access checks.
*/
accessChecks?: AccessCheckChain | undefined;
/**
* Show help if no args are passed to this command.
*
* NOTE: Subcommands count as arguments.
*/
argRequiredElseHelp: boolean;
}
export declare const Command: MessageFns<Command>;
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
$case: string;
value: unknown;
} ? {
$case: T["$case"];
value?: DeepPartial<T["value"]>;
} : T extends {} ? {
[K in keyof T]?: DeepPartial<T[K]>;
} : Partial<T>;
type KeysOfUnion<T> = T extends T ? keyof T : never;
type Exact<P, I extends P> = P extends Builtin ? P : P & {
[K in keyof P]: Exact<P[K], I[K]>;
} & {
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
};
interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
fromJSON(object: any): T;
toJSON(message: T): unknown;
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
}
export {};