Add emote reactions

This commit is contained in:
Aslan 2025-12-29 15:06:47 +01:00
parent a8e1a83e63
commit 6ab8dbd19e
6 changed files with 45 additions and 2 deletions

View file

@ -2,6 +2,7 @@ import type { FunctionDeclaration } from "@google/genai";
import { config, packageConfig } from "../../config.js";
import type { AIToolFunction } from "./types.js";
import { save, state } from "../../store/store.js";
import { EventType, RelationType } from "matrix-js-sdk";
const tools: FunctionDeclaration[] = [
{
@ -27,6 +28,20 @@ const tools: FunctionDeclaration[] = [
required: ["password"],
},
},
{
name: "sendReaction",
description: "Sends an emoji reaction to user's message",
parametersJsonSchema: {
type: "object",
properties: {
emoji: {
type: "string",
description: "one emoji to react with (example: 😀)",
},
},
required: ["emoji"],
},
},
{
name: "remember",
description: "Gets information about this AI bot",
@ -97,6 +112,28 @@ const toolFunctions: AIToolFunction[] = [
};
},
},
{
name: "sendReaction",
function: async (matrix, args) => {
if (args.emoji) {
await matrix.client.sendEvent(
matrix.roomId,
EventType.Reaction,
{
"m.relates_to": {
rel_type: RelationType.Annotation,
event_id: matrix.eventId,
key: args.emoji,
},
},
);
}
return {
message: "success",
};
},
},
{
name: "remember",
function: (_matrix, args) => {

View file

@ -19,6 +19,7 @@ interface AIToolMatrixData {
client: MatrixClient;
roomId: string;
sender: string;
eventId: string;
}
export {