fix: daemon status guidance and telegram fetch

This commit is contained in:
Peter Steinberger
2026-01-08 08:39:55 +01:00
parent 5b397c0f15
commit 9a11325cc9
5 changed files with 47 additions and 22 deletions

View File

@@ -1,13 +1,15 @@
// Bun compatibility: force native fetch under Bun; keep grammY defaults on Node.
// Ensure native fetch is used when available (Bun + Node 18+).
export function resolveTelegramFetch(
proxyFetch?: typeof fetch,
): typeof fetch | undefined {
if (proxyFetch) return proxyFetch;
const isBun = "Bun" in globalThis || Boolean(process?.versions?.bun);
if (!isBun) return undefined;
const fetchImpl = globalThis.fetch;
const isBun = "Bun" in globalThis || Boolean(process?.versions?.bun);
if (!fetchImpl) {
throw new Error("fetch is not available; set telegram.proxy in config");
if (isBun) {
throw new Error("fetch is not available; set telegram.proxy in config");
}
return undefined;
}
return fetchImpl;
}