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';
3
3
import { AiPluginOptions } from './types' ;
4
4
import { getAiWorkerContext } from './ai-context-worker' ;
5
5
import { getCommandKit } from 'commandkit' ;
6
+ import type { Message } from 'discord.js' ;
6
7
7
8
/**
8
9
* Retrieves the AI context.
@@ -28,6 +29,21 @@ export function useAI() {
28
29
return aiPlugin ;
29
30
}
30
31
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
+
31
47
/**
32
48
* Defines the AI plugin for the application.
33
49
* @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> {
68
68
commandkit : CommandKit ,
69
69
message : Message ,
70
70
) : Promise < void > {
71
- if ( message . author . bot || ! Object . keys ( this . toolsRecord ) . length ) return ;
71
+ if ( message . author . bot ) return ;
72
72
const {
73
73
messageFilter,
74
74
selectAiModel,
You can’t perform that action at this time.
0 commit comments