diff --git a/src/telegram/audit.ts b/src/telegram/audit.ts index 48e4a923f8b..b86953fa1b1 100644 --- a/src/telegram/audit.ts +++ b/src/telegram/audit.ts @@ -1,7 +1,5 @@ import type { TelegramGroupConfig } from "../config/types.js"; import { isRecord } from "../utils.js"; -import { fetchWithTimeout } from "../utils/fetch-timeout.js"; -import { makeProxyFetch } from "./proxy.js"; const TELEGRAM_API_BASE = "https://api.telegram.org"; @@ -87,7 +85,12 @@ export async function auditTelegramGroupMembership(params: { }; } - const fetcher = params.proxyUrl ? makeProxyFetch(params.proxyUrl) : fetch; + // Lazy import to avoid pulling `undici` (ProxyAgent) into cold-path callers that only need + // `collectTelegramUnmentionedGroupIds` (e.g. config audits). + const fetcher = params.proxyUrl + ? (await import("./proxy.js")).makeProxyFetch(params.proxyUrl) + : fetch; + const { fetchWithTimeout } = await import("../utils/fetch-timeout.js"); const base = `${TELEGRAM_API_BASE}/bot${token}`; const groups: TelegramGroupMembershipAuditEntry[] = [];