Files
openclaw/extensions/telegram/src/bot-message-context.session-runtime-test-support.ts
2026-04-20 20:52:31 +01:00

22 lines
729 B
TypeScript

export function finalizeTelegramInboundContextForTest(ctx: unknown): Record<string, unknown> {
const next = ctx as Record<string, unknown>;
const body = typeof next.Body === "string" ? next.Body : "";
next.Body = body;
next.BodyForAgent =
typeof next.BodyForAgent === "string"
? next.BodyForAgent
: typeof next.RawBody === "string"
? next.RawBody
: body;
next.BodyForCommands =
typeof next.BodyForCommands === "string"
? next.BodyForCommands
: typeof next.CommandBody === "string"
? next.CommandBody
: typeof next.RawBody === "string"
? next.RawBody
: body;
next.CommandAuthorized = Boolean(next.CommandAuthorized);
return next;
}