@yahaha-studio/kichi-forwarder 0.0.1-alpha.39 → 0.0.1-alpha.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.ts +5 -13
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -53,15 +53,6 @@ const FIXED_HOOK_STATUSES: Record<string, ActionResult> = {
|
|
|
53
53
|
},
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
-
const MESSAGE_RECEIVED_BUBBLES = [
|
|
57
|
-
"Let me see...",
|
|
58
|
-
"Gotcha!",
|
|
59
|
-
"On it!",
|
|
60
|
-
"Hmm, interesting",
|
|
61
|
-
"Copy that",
|
|
62
|
-
"Reading...",
|
|
63
|
-
];
|
|
64
|
-
|
|
65
56
|
const MESSAGE_SENT_BUBBLES = [
|
|
66
57
|
"All set!",
|
|
67
58
|
"Sent.",
|
|
@@ -250,11 +241,12 @@ function syncFixedStatus(status: ActionResult): void {
|
|
|
250
241
|
});
|
|
251
242
|
}
|
|
252
243
|
|
|
253
|
-
async function handleMessageReceivedHook(): Promise<void> {
|
|
244
|
+
async function handleMessageReceivedHook(content: string): Promise<void> {
|
|
254
245
|
if (!service?.hasValidIdentity() || !service?.isConnected()) {
|
|
255
246
|
return;
|
|
256
247
|
}
|
|
257
|
-
|
|
248
|
+
const trimmed = content.length > 7 ? content.slice(0, 7) + "..." : content;
|
|
249
|
+
service.sendHookNotify("message_received", `"${trimmed}"`);
|
|
258
250
|
}
|
|
259
251
|
|
|
260
252
|
function handleMessageSentHook(): void {
|
|
@@ -284,8 +276,8 @@ function registerPluginHooks(api: OpenClawPluginApi): void {
|
|
|
284
276
|
}
|
|
285
277
|
});
|
|
286
278
|
|
|
287
|
-
api.on("message_received", async () => {
|
|
288
|
-
await handleMessageReceivedHook();
|
|
279
|
+
api.on("message_received", async (event) => {
|
|
280
|
+
await handleMessageReceivedHook(event.content);
|
|
289
281
|
});
|
|
290
282
|
|
|
291
283
|
api.on("message_sent", () => {
|
package/package.json
CHANGED