Files
clawdbot/src/telegram/webhook-set.ts
2025-12-07 22:47:05 +01:00

20 lines
483 B
TypeScript

import { Bot } from "grammy";
export async function setTelegramWebhook(opts: {
token: string;
url: string;
secret?: string;
dropPendingUpdates?: boolean;
}) {
const bot = new Bot(opts.token);
await bot.api.setWebhook(opts.url, {
secret_token: opts.secret,
drop_pending_updates: opts.dropPendingUpdates ?? false,
});
}
export async function deleteTelegramWebhook(opts: { token: string }) {
const bot = new Bot(opts.token);
await bot.api.deleteWebhook();
}