diff --git a/apps/website/docs/api-reference/ai/classes/ai-cli-plugin.mdx b/apps/website/docs/api-reference/ai/classes/ai-cli-plugin.mdx new file mode 100644 index 00000000..4ed55713 --- /dev/null +++ b/apps/website/docs/api-reference/ai/classes/ai-cli-plugin.mdx @@ -0,0 +1,50 @@ +--- +title: "AiCliPlugin" +isDefaultIndex: false +generated: true +--- + +import MemberInfo from '@site/src/components/MemberInfo'; +import GenerationInfo from '@site/src/components/GenerationInfo'; +import MemberDescription from '@site/src/components/MemberDescription'; + + + + +## AiCliPlugin + + + + + +```ts title="Signature" +class AiCliPlugin extends CompilerPlugin { + public readonly name = 'AiCliPlugin'; + activate(ctx: CompilerPluginRuntime) => Promise; + deactivate(ctx: CompilerPluginRuntime) => Promise; +} +``` +* Extends: CompilerPlugin + + + +
+ +### name + + + + +### activate + +CompilerPluginRuntime) => Promise<void>`} /> + + +### deactivate + +CompilerPluginRuntime) => Promise<void>`} /> + + + + +
diff --git a/apps/website/docs/api-reference/ai/classes/ai-plugin.mdx b/apps/website/docs/api-reference/ai/classes/ai-plugin.mdx index eb4b533e..3c46a9b9 100644 --- a/apps/website/docs/api-reference/ai/classes/ai-plugin.mdx +++ b/apps/website/docs/api-reference/ai/classes/ai-plugin.mdx @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription'; ## AiPlugin - + diff --git a/apps/website/docs/api-reference/ai/functions/ai.mdx b/apps/website/docs/api-reference/ai/functions/ai.mdx index e95a711a..ad215d49 100644 --- a/apps/website/docs/api-reference/ai/functions/ai.mdx +++ b/apps/website/docs/api-reference/ai/functions/ai.mdx @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription'; ## ai - + Defines the AI plugin for the application. diff --git a/apps/website/docs/api-reference/ai/functions/create-system-prompt.mdx b/apps/website/docs/api-reference/ai/functions/create-system-prompt.mdx index 4d650441..353cbc29 100644 --- a/apps/website/docs/api-reference/ai/functions/create-system-prompt.mdx +++ b/apps/website/docs/api-reference/ai/functions/create-system-prompt.mdx @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription'; ## createSystemPrompt - + Creates the default system prompt for the AI bot based on the provided message context. This prompt includes the bot's role, current channel information, and response guidelines. diff --git a/apps/website/docs/api-reference/ai/functions/execute-ai.mdx b/apps/website/docs/api-reference/ai/functions/execute-ai.mdx index b5416144..9345b564 100644 --- a/apps/website/docs/api-reference/ai/functions/execute-ai.mdx +++ b/apps/website/docs/api-reference/ai/functions/execute-ai.mdx @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription'; ## executeAI - + Executes an AI command. diff --git a/apps/website/docs/api-reference/ai/functions/use-ai.mdx b/apps/website/docs/api-reference/ai/functions/use-ai.mdx index 09d9f164..aa992928 100644 --- a/apps/website/docs/api-reference/ai/functions/use-ai.mdx +++ b/apps/website/docs/api-reference/ai/functions/use-ai.mdx @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription'; ## useAI - + Fetches the AI plugin instance. diff --git a/apps/website/docs/api-reference/ai/functions/use-aicontext.mdx b/apps/website/docs/api-reference/ai/functions/use-aicontext.mdx index 87eaf054..33132c10 100644 --- a/apps/website/docs/api-reference/ai/functions/use-aicontext.mdx +++ b/apps/website/docs/api-reference/ai/functions/use-aicontext.mdx @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription'; ## useAIContext - + Retrieves the AI context. diff --git a/apps/website/docs/api-reference/ai/interfaces/ai-config.mdx b/apps/website/docs/api-reference/ai/interfaces/ai-config.mdx index 0d88018b..4c99ac93 100644 --- a/apps/website/docs/api-reference/ai/interfaces/ai-config.mdx +++ b/apps/website/docs/api-reference/ai/interfaces/ai-config.mdx @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription'; ## AiConfig - + Represents the configuration options for the AI plugin scoped to a specific command. diff --git a/apps/website/docs/api-reference/ai/interfaces/configure-ai.mdx b/apps/website/docs/api-reference/ai/interfaces/configure-ai.mdx index 23d77e27..1f31e2d9 100644 --- a/apps/website/docs/api-reference/ai/interfaces/configure-ai.mdx +++ b/apps/website/docs/api-reference/ai/interfaces/configure-ai.mdx @@ -23,16 +23,16 @@ interface ConfigureAI { messageFilter?: MessageFilter; selectAiModel: SelectAiModel; prepareSystemPrompt?: (ctx: AiContext, message: Message) => Promise; - preparePrompt?: ( - ctx: AiContext, - message: Message, + preparePrompt?: ( + ctx: AiContext, + message: Message, ) => Promise; onProcessingStart?: (ctx: AiContext, message: Message) => Promise; onProcessingFinish?: (ctx: AiContext, message: Message) => Promise; - onResult?: ( - ctx: AiContext, - message: Message, - result: AIGenerateResult, + onResult?: ( + ctx: AiContext, + message: Message, + result: AIGenerateResult, ) => Promise; onError?: (ctx: AiContext, message: Message, error: Error) => Promise; } @@ -49,24 +49,24 @@ Whether to disable the built-in tools. Default is false. MessageFilter`} /> -A filter function that determines whether a message should be processed by the AI. +A filter function that determines whether a message should be processed by the AI. CommandKit invokes this function before processing the message. ### selectAiModel SelectAiModel`} /> -A function that selects the AI model to use based on the message. +A function that selects the AI model to use based on the message. This function should return a promise that resolves to an object containing the model and options. ### prepareSystemPrompt AiContext, message: Message) => Promise<string>`} /> -A function that generates a system prompt based on the message. -This function should return a promise that resolves to a string containing the system prompt. +A function that generates a system prompt based on the message. +This function should return a promise that resolves to a string containing the system prompt. If not provided, a default system prompt will be used. ### preparePrompt -AiContext, message: Message, ) => Promise<string | AiMessage>`} /> +AiContext, message: Message, ) => Promise<string | AiMessage>`} /> A function that prepares the prompt for the AI model. ### onProcessingStart @@ -81,7 +81,7 @@ A function that gets called when the AI starts processing a message. A function that gets called when the AI finishes processing a message. ### onResult -AiContext, message: Message, result: AIGenerateResult, ) => Promise<void>`} /> +AiContext, message: Message, result: AIGenerateResult, ) => Promise<void>`} /> A function that gets called upon receiving the result from the AI model. ### onError diff --git a/apps/website/docs/api-reference/ai/variables/create-embed.mdx b/apps/website/docs/api-reference/ai/variables/create-embed.mdx new file mode 100644 index 00000000..10441bf4 --- /dev/null +++ b/apps/website/docs/api-reference/ai/variables/create-embed.mdx @@ -0,0 +1,19 @@ +--- +title: "CreateEmbed" +isDefaultIndex: false +generated: true +--- + +import MemberInfo from '@site/src/components/MemberInfo'; +import GenerationInfo from '@site/src/components/GenerationInfo'; +import MemberDescription from '@site/src/components/MemberDescription'; + + + + +## createEmbed + + + + + diff --git a/apps/website/docs/api-reference/ai/variables/get-member-by-id.mdx b/apps/website/docs/api-reference/ai/variables/get-member-by-id.mdx new file mode 100644 index 00000000..9e8645ee --- /dev/null +++ b/apps/website/docs/api-reference/ai/variables/get-member-by-id.mdx @@ -0,0 +1,19 @@ +--- +title: "GetMemberById" +isDefaultIndex: false +generated: true +--- + +import MemberInfo from '@site/src/components/MemberInfo'; +import GenerationInfo from '@site/src/components/GenerationInfo'; +import MemberDescription from '@site/src/components/MemberDescription'; + + + + +## getMemberById + + + + + diff --git a/apps/website/docs/api-reference/commandkit/classes/command-kit-plugin-runtime.mdx b/apps/website/docs/api-reference/commandkit/classes/command-kit-plugin-runtime.mdx index 464da5b6..e89643bc 100644 --- a/apps/website/docs/api-reference/commandkit/classes/command-kit-plugin-runtime.mdx +++ b/apps/website/docs/api-reference/commandkit/classes/command-kit-plugin-runtime.mdx @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription'; ## CommandKitPluginRuntime - + Represents the runtime environment for CommandKit plugins. @@ -23,6 +23,7 @@ class CommandKitPluginRuntime { getPlugins() => ; getPlugin(pluginName: string) => RuntimePlugin | null; get(plugin: T) => InstanceType | null; + preload(plugin: RuntimePlugin) => ; softRegisterPlugin(plugin: RuntimePlugin) => ; registerPlugin(plugin: RuntimePlugin) => ; unregisterPlugin(plugin: RuntimePlugin) => ; @@ -54,6 +55,11 @@ Checks if there are no plugins registered in this runtime. InstanceType<T> | null`} /> Fetches the given plugin +### preload + +RuntimePlugin) => `} /> + +Pre-loads the specified entrypoints for the given plugin. ### softRegisterPlugin RuntimePlugin) => `} /> diff --git a/apps/website/docs/api-reference/commandkit/classes/runtime-plugin.mdx b/apps/website/docs/api-reference/commandkit/classes/runtime-plugin.mdx index 3d92cd48..d5c99255 100644 --- a/apps/website/docs/api-reference/commandkit/classes/runtime-plugin.mdx +++ b/apps/website/docs/api-reference/commandkit/classes/runtime-plugin.mdx @@ -20,6 +20,7 @@ CommandKit plugin that runs at the runtime. ```ts title="Signature" class RuntimePlugin extends PluginCommon { public readonly type = PluginType.Runtime; + public readonly preload = new Set(); onBeforeCommandsLoad(ctx: CommandKitPluginRuntime) => Promise; onAfterCommandsLoad(ctx: CommandKitPluginRuntime) => Promise; onBeforeEventsLoad(ctx: CommandKitPluginRuntime) => Promise; @@ -52,6 +53,11 @@ class RuntimePlugin extends PluginCommo +### preload + + + + ### onBeforeCommandsLoad CommandKitPluginRuntime) => Promise<void>`} /> diff --git a/apps/website/docs/api-reference/commandkit/functions/is-runtime-plugin.mdx b/apps/website/docs/api-reference/commandkit/functions/is-runtime-plugin.mdx index bc06e910..cdef963b 100644 --- a/apps/website/docs/api-reference/commandkit/functions/is-runtime-plugin.mdx +++ b/apps/website/docs/api-reference/commandkit/functions/is-runtime-plugin.mdx @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription'; ## isRuntimePlugin - + diff --git a/apps/website/docs/api-reference/commandkit/interfaces/command-flag-context.mdx b/apps/website/docs/api-reference/commandkit/interfaces/command-flag-context.mdx index 5af9d70a..2fec6a23 100644 --- a/apps/website/docs/api-reference/commandkit/interfaces/command-flag-context.mdx +++ b/apps/website/docs/api-reference/commandkit/interfaces/command-flag-context.mdx @@ -21,34 +21,34 @@ Context for evaluating command flags in CommandKit. interface CommandFlagContext { client: Client; commandkit: CommandKit; - command: { - /** - * The interaction object if the command was invoked via an interaction. - * This can be a ChatInputCommandInteraction, AutocompleteInteraction, or ContextMenuCommandInteraction. - */ - interaction?: - | ChatInputCommandInteraction - | AutocompleteInteraction - | ContextMenuCommandInteraction; - /** - * The message object if the command was invoked via a message. - */ - message?: Message; - /** - * The guild where the command was invoked, if applicable. - * This will be null for commands invoked in DMs. - */ - guild: Guild | null; - /** - * The channel where the command was invoked. - * This can be a text channel, DM channel, or any other type of text-based channel. - */ - channel: TextBasedChannel | null; - /** - * The loaded command instance that is being executed. - * This contains the command's metadata and logic. - */ - command: LoadedCommand; + command: { + /** + * The interaction object if the command was invoked via an interaction. + * This can be a ChatInputCommandInteraction, AutocompleteInteraction, or ContextMenuCommandInteraction. + */ + interaction?: + | ChatInputCommandInteraction + | AutocompleteInteraction + | ContextMenuCommandInteraction; + /** + * The message object if the command was invoked via a message. + */ + message?: Message; + /** + * The guild where the command was invoked, if applicable. + * This will be null for commands invoked in DMs. + */ + guild: Guild | null; + /** + * The channel where the command was invoked. + * This can be a text channel, DM channel, or any other type of text-based channel. + */ + channel: TextBasedChannel | null; + /** + * The loaded command instance that is being executed. + * This contains the command's metadata and logic. + */ + command: LoadedCommand; }; event: null; } @@ -60,25 +60,25 @@ interface CommandFlagContext { -The Discord client instance. +The Discord client instance. This is the main entry point for interacting with the Discord API. ### commandkit CommandKit`} /> -The CommandKit instance, which provides access to the command framework. +The CommandKit instance, which provides access to the command framework. This includes commands, events, and other features of CommandKit. ### command -LoadedCommand; }`} /> +LoadedCommand; }`} /> -The command context, which includes information about the command being executed. +The command context, which includes information about the command being executed. This can include the interaction, message, guild, channel, and the loaded command. ### event -The event context is null for command flags, as they are not tied to a specific event. +The event context is null for command flags, as they are not tied to a specific event. This is used to differentiate between command and event flags. diff --git a/apps/website/docs/api-reference/commandkit/interfaces/context-parameters.mdx b/apps/website/docs/api-reference/commandkit/interfaces/context-parameters.mdx index d5c2939f..055f9c5a 100644 --- a/apps/website/docs/api-reference/commandkit/interfaces/context-parameters.mdx +++ b/apps/website/docs/api-reference/commandkit/interfaces/context-parameters.mdx @@ -22,14 +22,14 @@ interface ContextParameters + ### message diff --git a/apps/website/docs/api-reference/commandkit/interfaces/event-flag-context.mdx b/apps/website/docs/api-reference/commandkit/interfaces/event-flag-context.mdx index 11b19d7e..be20fb31 100644 --- a/apps/website/docs/api-reference/commandkit/interfaces/event-flag-context.mdx +++ b/apps/website/docs/api-reference/commandkit/interfaces/event-flag-context.mdx @@ -21,35 +21,35 @@ Context for evaluating event flags in CommandKit. interface EventFlagContext { client: Client; commandkit: CommandKit; - event: { - /** - * The parsed event data, which contains the raw data from the event. - * This can include information like user IDs, channel IDs, and other relevant data. - */ - data: ParsedEvent; - /** - * The name of the event being processed. - * This is the string identifier for the event, such as 'messageCreate' or 'guildMemberAdd'. - */ - event: string; - /** - * The namespace of the event, if applicable. - * This can be used to group related events or commands together. - * It is null if the event does not belong to a specific namespace. - */ - namespace: string | null; - /** - * The arguments passed to the event handler. - * This is an array of arguments that were passed when the event was triggered. - * It can be used to access specific data related to the event. - */ - arguments: any[]; - /** - * A function to retrieve the arguments for a specific event type. - * This allows for type-safe access to the arguments based on the event name. - * @param event - The name of the event to retrieve arguments for. - */ - argumentsAs(event: E): ClientEvents[E]; + event: { + /** + * The parsed event data, which contains the raw data from the event. + * This can include information like user IDs, channel IDs, and other relevant data. + */ + data: ParsedEvent; + /** + * The name of the event being processed. + * This is the string identifier for the event, such as 'messageCreate' or 'guildMemberAdd'. + */ + event: string; + /** + * The namespace of the event, if applicable. + * This can be used to group related events or commands together. + * It is null if the event does not belong to a specific namespace. + */ + namespace: string | null; + /** + * The arguments passed to the event handler. + * This is an array of arguments that were passed when the event was triggered. + * It can be used to access specific data related to the event. + */ + arguments: any[]; + /** + * A function to retrieve the arguments for a specific event type. + * This allows for type-safe access to the arguments based on the event name. + * @param event - The name of the event to retrieve arguments for. + */ + argumentsAs(event: E): ClientEvents[E]; }; command: null; } @@ -61,25 +61,25 @@ interface EventFlagContext { -The Discord client instance. +The Discord client instance. This is the main entry point for interacting with the Discord API. ### commandkit CommandKit`} /> -The CommandKit instance, which provides access to the command framework. +The CommandKit instance, which provides access to the command framework. This includes commands, events, and other features of CommandKit. ### event -ParsedEvent; /** * The name of the event being processed. * This is the string identifier for the event, such as 'messageCreate' or 'guildMemberAdd'. */ event: string; /** * The namespace of the event, if applicable. * This can be used to group related events or commands together. * It is null if the event does not belong to a specific namespace. */ namespace: string | null; /** * The arguments passed to the event handler. * This is an array of arguments that were passed when the event was triggered. * It can be used to access specific data related to the event. */ arguments: any[]; /** * A function to retrieve the arguments for a specific event type. * This allows for type-safe access to the arguments based on the event name. * @param event - The name of the event to retrieve arguments for. */ argumentsAs<E extends keyof ClientEvents>(event: E): ClientEvents[E]; }`} /> +ParsedEvent; /** * The name of the event being processed. * This is the string identifier for the event, such as 'messageCreate' or 'guildMemberAdd'. */ event: string; /** * The namespace of the event, if applicable. * This can be used to group related events or commands together. * It is null if the event does not belong to a specific namespace. */ namespace: string | null; /** * The arguments passed to the event handler. * This is an array of arguments that were passed when the event was triggered. * It can be used to access specific data related to the event. */ arguments: any[]; /** * A function to retrieve the arguments for a specific event type. * This allows for type-safe access to the arguments based on the event name. * @param event - The name of the event to retrieve arguments for. */ argumentsAs<E extends keyof ClientEvents>(event: E): ClientEvents[E]; }`} /> -The event context, which includes information about the event being processed. +The event context, which includes information about the event being processed. This can include the parsed event data, the event name, and the namespace if applicable. ### command -The command context is null for event flags, as they are not tied to a specific command. +The command context is null for event flags, as they are not tied to a specific command. This is used to differentiate between command and event flags. diff --git a/package.json b/package.json index 3a160eff..2b957add 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,8 @@ "form-data@>=4.0.0 <4.0.4": ">=4.0.4", "tmp@<=0.2.3": ">=0.2.4", "mermaid@>=11.1.0 <11.10.0": ">=11.10.0", - "mermaid@>=11.0.0-alpha.1 <11.10.0": ">=11.10.0" + "mermaid@>=11.0.0-alpha.1 <11.10.0": ">=11.10.0", + "devalue@<5.3.2": ">=5.3.2" }, "onlyBuiltDependencies": [ "@swc/core",