Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions apps/website/docs/api-reference/ai/classes/ai-cli-plugin.mdx
Original file line number Diff line number Diff line change
@@ -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';

<!-- This file was generated from the CommandKit source. Do not modify. Instead, re-run the "docgen" script -->


## AiCliPlugin

<GenerationInfo sourceFile="packages/ai/src/cli-plugin.ts" sourceLine="16" packageName="@commandkit/ai" />



```ts title="Signature"
class AiCliPlugin extends CompilerPlugin {
public readonly name = 'AiCliPlugin';
activate(ctx: CompilerPluginRuntime) => Promise<void>;
deactivate(ctx: CompilerPluginRuntime) => Promise<void>;
}
```
* Extends: <code><a href='/docs/next/api-reference/commandkit/classes/compiler-plugin#compilerplugin'>CompilerPlugin</a></code>



<div className="members-wrapper">

### name

<MemberInfo kind="property" type={``} />


### activate

<MemberInfo kind="method" type={`(ctx: <a href='/docs/next/api-reference/commandkit/classes/compiler-plugin-runtime#compilerpluginruntime'>CompilerPluginRuntime</a>) => Promise&#60;void&#62;`} />


### deactivate

<MemberInfo kind="method" type={`(ctx: <a href='/docs/next/api-reference/commandkit/classes/compiler-plugin-runtime#compilerpluginruntime'>CompilerPluginRuntime</a>) => Promise&#60;void&#62;`} />




</div>
2 changes: 1 addition & 1 deletion apps/website/docs/api-reference/ai/classes/ai-plugin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## AiPlugin

<GenerationInfo sourceFile="packages/ai/src/plugin.ts" sourceLine="39" packageName="@commandkit/ai" />
<GenerationInfo sourceFile="packages/ai/src/plugin.ts" sourceLine="43" packageName="@commandkit/ai" />



Expand Down
2 changes: 1 addition & 1 deletion apps/website/docs/api-reference/ai/functions/ai.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## ai

<GenerationInfo sourceFile="packages/ai/src/index.ts" sourceLine="52" packageName="@commandkit/ai" />
<GenerationInfo sourceFile="packages/ai/src/index.ts" sourceLine="53" packageName="@commandkit/ai" />

Defines the AI plugin for the application.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## createSystemPrompt

<GenerationInfo sourceFile="packages/ai/src/system-prompt.ts" sourceLine="7" packageName="@commandkit/ai" />
<GenerationInfo sourceFile="packages/ai/src/system-prompt.ts" sourceLine="35" packageName="@commandkit/ai" />

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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## executeAI

<GenerationInfo sourceFile="packages/ai/src/index.ts" sourceLine="42" packageName="@commandkit/ai" />
<GenerationInfo sourceFile="packages/ai/src/index.ts" sourceLine="43" packageName="@commandkit/ai" />

Executes an AI command.

Expand Down
2 changes: 1 addition & 1 deletion apps/website/docs/api-reference/ai/functions/use-ai.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## useAI

<GenerationInfo sourceFile="packages/ai/src/index.ts" sourceLine="19" packageName="@commandkit/ai" />
<GenerationInfo sourceFile="packages/ai/src/index.ts" sourceLine="20" packageName="@commandkit/ai" />

Fetches the AI plugin instance.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## useAIContext

<GenerationInfo sourceFile="packages/ai/src/index.ts" sourceLine="11" packageName="@commandkit/ai" />
<GenerationInfo sourceFile="packages/ai/src/index.ts" sourceLine="12" packageName="@commandkit/ai" />

Retrieves the AI context.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## AiConfig

<GenerationInfo sourceFile="packages/ai/src/plugin.ts" sourceLine="20" packageName="@commandkit/ai" />
<GenerationInfo sourceFile="packages/ai/src/plugin.ts" sourceLine="22" packageName="@commandkit/ai" />

Represents the configuration options for the AI plugin scoped to a specific command.

Expand Down
26 changes: 13 additions & 13 deletions apps/website/docs/api-reference/ai/interfaces/configure-ai.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ interface ConfigureAI {
messageFilter?: MessageFilter;
selectAiModel: SelectAiModel;
prepareSystemPrompt?: (ctx: AiContext, message: Message) => Promise<string>;
preparePrompt?: (
ctx: AiContext,
message: Message,
preparePrompt?: (
ctx: AiContext,
message: Message,
) => Promise<string | AiMessage>;
onProcessingStart?: (ctx: AiContext, message: Message) => Promise<void>;
onProcessingFinish?: (ctx: AiContext, message: Message) => Promise<void>;
onResult?: (
ctx: AiContext,
message: Message,
result: AIGenerateResult,
onResult?: (
ctx: AiContext,
message: Message,
result: AIGenerateResult,
) => Promise<void>;
onError?: (ctx: AiContext, message: Message, error: Error) => Promise<void>;
}
Expand All @@ -49,24 +49,24 @@ Whether to disable the built-in tools. Default is false.

<MemberInfo kind="property" type={`<a href='/docs/next/api-reference/ai/types/message-filter#messagefilter'>MessageFilter</a>`} />

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

<MemberInfo kind="property" type={`<a href='/docs/next/api-reference/ai/types/select-ai-model#selectaimodel'>SelectAiModel</a>`} />

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

<MemberInfo kind="property" type={`(ctx: <a href='/docs/next/api-reference/ai/classes/ai-context#aicontext'>AiContext</a>, message: Message) =&#62; Promise&#60;string&#62;`} />

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

<MemberInfo kind="property" type={`( ctx: <a href='/docs/next/api-reference/ai/classes/ai-context#aicontext'>AiContext</a>, message: Message, ) =&#62; Promise&#60;string | <a href='/docs/next/api-reference/ai/types/ai-message#aimessage'>AiMessage</a>&#62;`} />
<MemberInfo kind="property" type={`( ctx: <a href='/docs/next/api-reference/ai/classes/ai-context#aicontext'>AiContext</a>, message: Message, ) =&#62; Promise&#60;string | <a href='/docs/next/api-reference/ai/types/ai-message#aimessage'>AiMessage</a>&#62;`} />

A function that prepares the prompt for the AI model.
### onProcessingStart
Expand All @@ -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

<MemberInfo kind="property" type={`( ctx: <a href='/docs/next/api-reference/ai/classes/ai-context#aicontext'>AiContext</a>, message: Message, result: <a href='/docs/next/api-reference/ai/types/aigenerate-result#aigenerateresult'>AIGenerateResult</a>, ) =&#62; Promise&#60;void&#62;`} />
<MemberInfo kind="property" type={`( ctx: <a href='/docs/next/api-reference/ai/classes/ai-context#aicontext'>AiContext</a>, message: Message, result: <a href='/docs/next/api-reference/ai/types/aigenerate-result#aigenerateresult'>AIGenerateResult</a>, ) =&#62; Promise&#60;void&#62;`} />

A function that gets called upon receiving the result from the AI model.
### onError
Expand Down
19 changes: 19 additions & 0 deletions apps/website/docs/api-reference/ai/variables/create-embed.mdx
Original file line number Diff line number Diff line change
@@ -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';

<!-- This file was generated from the CommandKit source. Do not modify. Instead, re-run the "docgen" script -->


## createEmbed

<GenerationInfo sourceFile="packages/ai/src/tools/create-embed.ts" sourceLine="5" packageName="@commandkit/ai" />



19 changes: 19 additions & 0 deletions apps/website/docs/api-reference/ai/variables/get-member-by-id.mdx
Original file line number Diff line number Diff line change
@@ -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';

<!-- This file was generated from the CommandKit source. Do not modify. Instead, re-run the "docgen" script -->


## getMemberById

<GenerationInfo sourceFile="packages/ai/src/tools/get-member-by-id.ts" sourceLine="5" packageName="@commandkit/ai" />



Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## CommandKitPluginRuntime

<GenerationInfo sourceFile="packages/commandkit/src/plugins/plugin-runtime/CommandKitPluginRuntime.ts" sourceLine="15" packageName="commandkit" />
<GenerationInfo sourceFile="packages/commandkit/src/plugins/plugin-runtime/CommandKitPluginRuntime.ts" sourceLine="17" packageName="commandkit" />

Represents the runtime environment for CommandKit plugins.

Expand All @@ -23,6 +23,7 @@ class CommandKitPluginRuntime {
getPlugins() => ;
getPlugin(pluginName: string) => RuntimePlugin | null;
get(plugin: T) => InstanceType<T> | null;
preload(plugin: RuntimePlugin) => ;
softRegisterPlugin(plugin: RuntimePlugin) => ;
registerPlugin(plugin: RuntimePlugin) => ;
unregisterPlugin(plugin: RuntimePlugin) => ;
Expand Down Expand Up @@ -54,6 +55,11 @@ Checks if there are no plugins registered in this runtime.
<MemberInfo kind="method" type={`(plugin: T) => InstanceType&#60;T&#62; | null`} />

Fetches the given plugin
### preload

<MemberInfo kind="method" type={`(plugin: <a href='/docs/next/api-reference/commandkit/classes/runtime-plugin#runtimeplugin'>RuntimePlugin</a>) => `} />

Pre-loads the specified entrypoints for the given plugin.
### softRegisterPlugin

<MemberInfo kind="method" type={`(plugin: <a href='/docs/next/api-reference/commandkit/classes/runtime-plugin#runtimeplugin'>RuntimePlugin</a>) => `} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ CommandKit plugin that runs at the runtime.
```ts title="Signature"
class RuntimePlugin<T extends PluginOptions = PluginOptions> extends PluginCommon<T, CommandKitPluginRuntime> {
public readonly type = PluginType.Runtime;
public readonly preload = new Set<string>();
onBeforeCommandsLoad(ctx: CommandKitPluginRuntime) => Promise<void>;
onAfterCommandsLoad(ctx: CommandKitPluginRuntime) => Promise<void>;
onBeforeEventsLoad(ctx: CommandKitPluginRuntime) => Promise<void>;
Expand Down Expand Up @@ -52,6 +53,11 @@ class RuntimePlugin<T extends PluginOptions = PluginOptions> extends PluginCommo
<MemberInfo kind="property" type={``} />


### preload

<MemberInfo kind="property" type={``} />


### onBeforeCommandsLoad

<MemberInfo kind="method" type={`(ctx: <a href='/docs/next/api-reference/commandkit/classes/command-kit-plugin-runtime#commandkitpluginruntime'>CommandKitPluginRuntime</a>) => Promise&#60;void&#62;`} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## isRuntimePlugin

<GenerationInfo sourceFile="packages/commandkit/src/plugins/RuntimePlugin.ts" sourceLine="198" packageName="commandkit" />
<GenerationInfo sourceFile="packages/commandkit/src/plugins/RuntimePlugin.ts" sourceLine="200" packageName="commandkit" />



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,34 +21,34 @@ Context for evaluating command flags in CommandKit.
interface CommandFlagContext {
client: Client<true>;
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;
}
Expand All @@ -60,25 +60,25 @@ interface CommandFlagContext {

<MemberInfo kind="property" type={`Client&#60;true&#62;`} />

The Discord client instance.
The Discord client instance.
This is the main entry point for interacting with the Discord API.
### commandkit

<MemberInfo kind="property" type={`<a href='/docs/next/api-reference/commandkit/classes/command-kit#commandkit'>CommandKit</a>`} />

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

<MemberInfo kind="property" type={`{ /** * 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: <a href='/docs/next/api-reference/commandkit/interfaces/loaded-command#loadedcommand'>LoadedCommand</a>; }`} />
<MemberInfo kind="property" type={`{ /** * 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: <a href='/docs/next/api-reference/commandkit/interfaces/loaded-command#loadedcommand'>LoadedCommand</a>; }`} />

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

<MemberInfo kind="property" type={`null`} />

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.


Expand Down
Loading
Loading