#!/usr/bin/env -S npx tsx import { notify } from "./src/bot.js"; import { getFirstAvailableAppointment } from "./src/appointments.js"; async function run() { const availableAppointment = await getFirstAvailableAppointment(); if (!availableAppointment) { console.log("no appt found"); return; } if (new Date() > availableAppointment) { console.log("found one but already expired", availableAppointment.toISOString()); return; } console.log("found one", availableAppointment.toISOString()); await notify(availableAppointment); } const sleep = async (ms: number) => new Promise(r => setTimeout(r, ms)); while (true) { await run(); await sleep(60_000); }