import { hatchet } from "./client"; import { processTelegramInbound, processTelegramOutbound } from "./tasks"; import path from "node:path"; import { fileURLToPath } from "node:url"; async function main() { const worker = await hatchet.worker("telegram-worker", { workflows: [processTelegramInbound, processTelegramOutbound], }); await worker.start(); } const isMain = process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url); if (isMain) { main().catch((error) => { const message = error instanceof Error ? error.stack || error.message : String(error); console.error(`[telegram_worker/hatchet] worker failed: ${message}`); process.exitCode = 1; }); }