Skip to content

Latest commit

 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ACMilanBot

Say hello to the bot for the AC Milan subreddit.

Authentication

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"

Match thread creation

Step 1 - Schedule

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"

Step 2 - Pre-Match

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":{}}'

Step 3 - Match

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.

Step 4 - Live and Post-Match

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.

About

Bot for AC Milan subreddit

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages