fix: force telegram native fetch under bun

This commit is contained in:
Peter Steinberger
2026-01-08 04:40:29 +01:00
parent 3178a3014d
commit ab98ffe9fe
7 changed files with 101 additions and 11 deletions

8
src/telegram/fetch.ts Normal file
View File

@@ -0,0 +1,8 @@
// BAN compatibility: force native fetch to avoid grammY's node-fetch shim under Bun.
export function resolveTelegramFetch(proxyFetch?: typeof fetch): typeof fetch {
const fetchImpl = proxyFetch ?? globalThis.fetch;
if (!fetchImpl) {
throw new Error("fetch is not available; set telegram.proxy in config");
}
return fetchImpl;
}