File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { AiPlugin } from './plugin';
33import { AiPluginOptions } from './types' ;
44import { getAiWorkerContext } from './ai-context-worker' ;
55import { getCommandKit } from 'commandkit' ;
6+ import type { Message } from 'discord.js' ;
67
78/**
89 * Retrieves the AI context.
@@ -28,6 +29,21 @@ export function useAI() {
2829 return aiPlugin ;
2930}
3031
32+ /**
33+ * Executes an AI command.
34+ * @param message The message to execute the AI command on
35+ * @example
36+ * ```ts
37+ * const message = await getMessageSomehow();
38+ * // use AI to process the message
39+ * await executeAI(message);
40+ * ```
41+ */
42+ export function executeAI ( message : Message ) : Promise < void > {
43+ const aiPlugin = useAI ( ) ;
44+ return aiPlugin . executeAI ( message ) ;
45+ }
46+
3147/**
3248 * Defines the AI plugin for the application.
3349 * @param options The options for the AI plugin
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ export class AiPlugin extends RuntimePlugin<AiPluginOptions> {
6868 commandkit : CommandKit ,
6969 message : Message ,
7070 ) : Promise < void > {
71- if ( message . author . bot || ! Object . keys ( this . toolsRecord ) . length ) return ;
71+ if ( message . author . bot ) return ;
7272 const {
7373 messageFilter,
7474 selectAiModel,
You can’t perform that action at this time.
0 commit comments