fix(telegram): gate native fetch to bun
This commit is contained in:
@@ -7,9 +7,11 @@ export async function setTelegramWebhook(opts: {
|
||||
secret?: string;
|
||||
dropPendingUpdates?: boolean;
|
||||
}) {
|
||||
const bot = new Bot(opts.token, {
|
||||
client: { fetch: resolveTelegramFetch() },
|
||||
});
|
||||
const fetchImpl = resolveTelegramFetch();
|
||||
const bot = new Bot(
|
||||
opts.token,
|
||||
fetchImpl ? { client: { fetch: fetchImpl } } : undefined,
|
||||
);
|
||||
await bot.api.setWebhook(opts.url, {
|
||||
secret_token: opts.secret,
|
||||
drop_pending_updates: opts.dropPendingUpdates ?? false,
|
||||
@@ -17,8 +19,10 @@ export async function setTelegramWebhook(opts: {
|
||||
}
|
||||
|
||||
export async function deleteTelegramWebhook(opts: { token: string }) {
|
||||
const bot = new Bot(opts.token, {
|
||||
client: { fetch: resolveTelegramFetch() },
|
||||
});
|
||||
const fetchImpl = resolveTelegramFetch();
|
||||
const bot = new Bot(
|
||||
opts.token,
|
||||
fetchImpl ? { client: { fetch: fetchImpl } } : undefined,
|
||||
);
|
||||
await bot.api.deleteWebhook();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user