fix: daemon status guidance and telegram fetch
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user