fix: force telegram native fetch under bun

This commit is contained in:
Peter Steinberger committed 2026-01-08 05:20:38 +01:00
1 parent 3178a3014d
commit ab98ffe9fe
7 files changed
+101 -11

No files matched your search

+7 -2
View File
@@ -1,4 +1,5 @@
import { Bot } from "grammy";
import { resolveTelegramFetch } from "./fetch.js";
export async function setTelegramWebhook(opts: {
token: string;
@@ -6,7 +7,9 @@ export async function setTelegramWebhook(opts: {
secret?: string;
dropPendingUpdates?: boolean;
}) {
const bot = new Bot(opts.token);
const bot = new Bot(opts.token, {
client: { fetch: resolveTelegramFetch() },
});
await bot.api.setWebhook(opts.url, {
secret_token: opts.secret,
drop_pending_updates: opts.dropPendingUpdates ?? false,
@@ -14,6 +17,8 @@ export async function setTelegramWebhook(opts: {
}
export async function deleteTelegramWebhook(opts: { token: string }) {
const bot = new Bot(opts.token);
const bot = new Bot(opts.token, {
client: { fetch: resolveTelegramFetch() },
});
await bot.api.deleteWebhook();
}