telegram: harden delete fallback and bump googlechat peer floor

This commit is contained in:
Alexander Bolshakov 2026-03-09 22:35:17 +01:00 committed by OpenClaw Agent
parent f70d58cd9d
commit 8d2eb609e8
2 changed files with 27 additions and 0 deletions

View File

@ -214,7 +214,11 @@ export const telegramMessageActions: ChannelMessageActionAdapter = {
if (action === "delete") {
const chatId = readTelegramChatIdParam(params);
const hasMessageIdParam = Object.hasOwn(params, "messageId");
const messageId = readTelegramMessageIdParam(params, { required: false });
if (hasMessageIdParam && typeof messageId !== "number") {
throw new Error("messageId must be a valid number for action=delete.");
}
if (typeof messageId === "number") {
return await handleTelegramAction(
{

View File

@ -869,6 +869,29 @@ describe("telegramMessageActions", () => {
expect(handleTelegramAction).not.toHaveBeenCalled();
});
it("rejects invalid delete messageId instead of falling back to topic deletion", async () => {
const cfg = telegramCfg();
const handleAction = telegramMessageActions.handleAction;
if (!handleAction) {
throw new Error("telegram handleAction unavailable");
}
await expect(
handleAction({
channel: "telegram",
action: "delete",
params: {
to: "-1001234567890",
messageId: "oops",
topicId: 271,
},
cfg,
}),
).rejects.toThrow(/messageId must be a valid number for action=delete/i);
expect(handleTelegramAction).not.toHaveBeenCalled();
});
it("rejects topic-delete when threadId/topicId is missing", async () => {
const cfg = telegramCfg();
const handleAction = telegramMessageActions.handleAction;