fix: force telegram native fetch under bun
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user