fix(telegram): surface REACTION_INVALID as non-fatal warning (#14340)

Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
0xRain
2026-02-12 14:28:47 +08:00
committed by GitHub
parent 4094cef233
commit 4b86c9e555
3 changed files with 49 additions and 3 deletions

View File

@@ -59,6 +59,37 @@ describe("handleTelegramAction", () => {
);
});
it("surfaces non-fatal reaction warnings", async () => {
reactMessageTelegram.mockResolvedValueOnce({
ok: false,
warning: "Reaction unavailable: ✅",
});
const cfg = {
channels: { telegram: { botToken: "tok", reactionLevel: "minimal" } },
} as OpenClawConfig;
const result = await handleTelegramAction(
{
action: "react",
chatId: "123",
messageId: "456",
emoji: "✅",
},
cfg,
);
const textPayload = result.content.find((item) => item.type === "text");
expect(textPayload?.type).toBe("text");
const parsed = JSON.parse((textPayload as { type: "text"; text: string }).text) as {
ok: boolean;
warning?: string;
added?: string;
};
expect(parsed).toMatchObject({
ok: false,
warning: "Reaction unavailable: ✅",
added: "✅",
});
});
it("adds reactions when reactionLevel is extensive", async () => {
const cfg = {
channels: { telegram: { botToken: "tok", reactionLevel: "extensive" } },