From 71309c064a20005e131052f3ed61217fd6f6fa20 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 9 Jan 2026 00:31:07 +0100 Subject: [PATCH] fix: drop redundant telegram audit union --- src/telegram/audit.ts | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/telegram/audit.ts b/src/telegram/audit.ts index 7224fba86..61d3e01db 100644 --- a/src/telegram/audit.ts +++ b/src/telegram/audit.ts @@ -102,22 +102,30 @@ export async function auditTelegramGroupMembership(params: { const res = await fetchWithTimeout(url, params.timeoutMs, fetcher); const json = (await res.json()) as | TelegramApiOk<{ status?: string }> - | TelegramApiErr - | unknown; + | TelegramApiErr; if (!res.ok || !isRecord(json) || json.ok !== true) { const desc = - isRecord(json) && json.ok === false && typeof json.description === "string" + isRecord(json) && + json.ok === false && + typeof json.description === "string" ? json.description : `getChatMember failed (${res.status})`; groups.push({ chatId, ok: false, status: null, error: desc }); continue; } const status = isRecord((json as TelegramApiOk).result) - ? (json as TelegramApiOk<{ status?: string }>).result.status ?? null + ? ((json as TelegramApiOk<{ status?: string }>).result.status ?? null) : null; const ok = - status === "creator" || status === "administrator" || status === "member"; - groups.push({ chatId, ok, status, error: ok ? null : "bot not in group" }); + status === "creator" || + status === "administrator" || + status === "member"; + groups.push({ + chatId, + ok, + status, + error: ok ? null : "bot not in group", + }); } catch (err) { groups.push({ chatId, @@ -137,4 +145,3 @@ export async function auditTelegramGroupMembership(params: { elapsedMs: Date.now() - started, }; } -