This commit is contained in:
Onur
2026-01-08 11:08:08 +03:00
committed by Peter Steinberger
parent d6256a388e
commit 2ab5890eab
2 changed files with 35 additions and 1 deletions

View File

@@ -153,8 +153,12 @@ export function createTelegramBot(opts: TelegramBotOptions) {
},
};
const fetchImpl = resolveTelegramFetch(opts.proxyFetch);
const isBun = "Bun" in globalThis || Boolean(process?.versions?.bun);
const shouldProvideFetch = Boolean(opts.proxyFetch) || isBun;
const client: ApiClientOptions | undefined = fetchImpl
? { fetch: fetchImpl as unknown as ApiClientOptions["fetch"] }
? shouldProvideFetch
? { fetch: fetchImpl as unknown as ApiClientOptions["fetch"] }
: undefined
: undefined;
const bot = new Bot(opts.token, client ? { client } : undefined);