feat: make telegram reactions visible to clawdbot

This commit is contained in:
Bohdan Podvirnyi
2026-01-13 21:13:05 +02:00
committed by Peter Steinberger
parent 01c43b0b0c
commit d05c3d0659
7 changed files with 5915 additions and 3 deletions

View File

@@ -0,0 +1,38 @@
import { afterEach, describe, expect, it } from "vitest";
import {
clearSentMessageCache,
recordSentMessage,
wasSentByBot,
} from "./sent-message-cache.js";
describe("sent-message-cache", () => {
afterEach(() => {
clearSentMessageCache();
});
it("records and retrieves sent messages", () => {
recordSentMessage(123, 1);
recordSentMessage(123, 2);
recordSentMessage(456, 10);
expect(wasSentByBot(123, 1)).toBe(true);
expect(wasSentByBot(123, 2)).toBe(true);
expect(wasSentByBot(456, 10)).toBe(true);
expect(wasSentByBot(123, 3)).toBe(false);
expect(wasSentByBot(789, 1)).toBe(false);
});
it("handles string chat IDs", () => {
recordSentMessage("123", 1);
expect(wasSentByBot("123", 1)).toBe(true);
expect(wasSentByBot(123, 1)).toBe(true);
});
it("clears cache", () => {
recordSentMessage(123, 1);
expect(wasSentByBot(123, 1)).toBe(true);
clearSentMessageCache();
expect(wasSentByBot(123, 1)).toBe(false);
});
});