Say hello to the bot for the AC Milan subreddit.
Basic authentication is required to make any requests. The allowed user and password are stored as environment variables.
Example request:
curl http://localhost:3000/ping \
-u "user:password"A cron job runs every day at 00:05 UTC to check if there's a match on that day. In case there is a match, a new cron job is created that runs 12 hours before kick off.
Example request:
curl -X POST http://localhost:3000/schedule \
-u "user:password"12 hours before kick off, a cron job creates the Pre-Match thread on Reddit. It also deletes itself and creates a new cron job that runs 30 minutes before kick off.
Example request:
curl -X POST http://localhost:3000/pre-match \
-H 'Content-Type: application/json' \
-u "user:password" \
-d '{"competition":{"name":"Serie A"},"date":"2023-08-25T20:25:00","venue":{},"home":{"name":"AC Milan"},"away":{"name":"Boca Juniors"},"goals":{}}'30 minutes before kick off, a cron job creates the Match thread on Reddit. It also deletes itself and creates a new cron job that runs every minute.
A cron job follows the match minute by minute. When the match is over, it creates the Post-Match thread on Reddit and it deletes itself.