fix(telegram): gate native fetch to bun

This commit is contained in:
Peter Steinberger
2026-01-08 08:10:10 +01:00
parent c1e97fab80
commit c241cb25bd
5 changed files with 27 additions and 19 deletions

View File

@@ -152,11 +152,11 @@ export function createTelegramBot(opts: TelegramBotOptions) {
},
};
const fetchImpl = resolveTelegramFetch(opts.proxyFetch);
const client: ApiClientOptions = {
fetch: fetchImpl as unknown as ApiClientOptions["fetch"],
};
const client: ApiClientOptions | undefined = fetchImpl
? { fetch: fetchImpl as unknown as ApiClientOptions["fetch"] }
: undefined;
const bot = new Bot(opts.token, { client });
const bot = new Bot(opts.token, client ? { client } : undefined);
bot.api.config.use(apiThrottler());
bot.use(sequentialize(getTelegramSequentialKey));