fix: accept numeric Telegram react ids (#4533) (thanks @Ayush10)

This commit is contained in:
Ayaan Zaidi
2026-01-30 14:55:37 +05:30
committed by Ayaan Zaidi
parent f760aa302c
commit bc432d8435
3 changed files with 55 additions and 30 deletions

View File

@@ -118,4 +118,27 @@ describe("telegramMessageActions", () => {
expect(handleTelegramAction).not.toHaveBeenCalled();
});
it("accepts numeric messageId and channelId for reactions", async () => {
handleTelegramAction.mockClear();
const cfg = { channels: { telegram: { botToken: "tok" } } } as OpenClawConfig;
await telegramMessageActions.handleAction({
action: "react",
params: {
channelId: 123,
messageId: 456,
emoji: "ok",
},
cfg,
accountId: undefined,
});
expect(handleTelegramAction).toHaveBeenCalledTimes(1);
const call = handleTelegramAction.mock.calls[0]?.[0] as Record<string, unknown>;
expect(call.action).toBe("react");
expect(String(call.chatId)).toBe("123");
expect(String(call.messageId)).toBe("456");
expect(call.emoji).toBe("ok");
});
});