diff --git a/src/index.d.ts b/src/index.d.ts index 91d2d5501..e5b94b845 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -386,6 +386,34 @@ export type Interpreter = ( sendMessage?: boolean ) => Promise; +/** + * Available custom function types that FunctionManager supports. + */ +export type CustomFunctionTypes = "aoi.js" | "djs"; + +/** + * Base custom function interface. + */ +export interface BaseCustomFunction { + name: `$${string}`; + type: T; +} + +/** + * Represents the structure for an aoi.js custom function type. + */ +export interface CustomAoiJSFunction extends BaseCustomFunction { + params?: string[]; + code: string; +} + +/** + * Represents the structure for a discord.js custom function type. + */ +export interface CustomDiscordJSFunction extends BaseCustomFunction { + code(d: Data): Promise> | Record +} + // FunctionManager export declare class FunctionManager { client: AoiClient; @@ -395,7 +423,7 @@ export declare class FunctionManager { interpreter: Interpreter; constructor(client: AoiClient); cacheFunctions(): void; - createFunction(data: Array>): void; + createFunction(...data: (CustomAoiJSFunction | CustomDiscordJSFunction)[]): void; findFunctions(code: string): string[]; serializeCode(code: string): string[]; }