Overview
src/scheduler/cronJobs.ts registers a single node-cron job that drives the bot’s daily broadcast. The schedule expression is read from config.cron.schedule, but the timezone is hardcoded to America/Bogota in the cron.schedule call.
Exported function
startScheduler
Cron job behavior
On each scheduled tick the job:- Runs the full pipeline by calling
fetchAndMarkDeals(). This fetches deals, applies both filter layers, saves a snapshot, and marks results as notified. - On
ai_error— logs the failure reason and returns without sending any message. Sending a “no deals today” message when the AI actually failed would be misleading to subscribers. - On
no_deals— logs that no deals passed the filters and returns silently. This is a normal condition, not an error. - On
ok— fetches the current COP exchange rate, formats the deals message, and callsnotifyAllUsers()to broadcast to all subscribers.
Source code
The timezone is hardcoded to
'America/Bogota' in the cron.schedule options, independent of the server’s local timezone. This ensures the broadcast fires at the correct local time regardless of where the host machine is running.