Skip to content

stephenyeargin/hockey-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

66 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Hockey Bot

Node CI CodeQL

Posts the latest playoff odds for NHL teams to Mastodon.

Requirements

May also have additional requirements for canvas, depending on the operating system.

Configuration

These values must be set in the running process's environment. You can use a tool like dotenv or the newer dotenvx.

Environment Variable Required? Description Example
TEAM_CODE No1 Abbreviation of team (as shown on MoneyPuck) NSH
REDIS_URL Yes URL of a Redis server redis://localhost:6379
MASTODON_BASE_URL Yes Base URL of the Mastodon server https://mastodon.social
MASTODON_TOKEN Yes API token for your bot someratherlong_apitoken123

Running

The bot is designed to be run on a regular schedule (likely no more than hourly) via cron or similar service.

0 * * * * cd your/path && dotenv --file .env.development run -- npm start

Commands

npm start

Runs the application

npm run start:dev

Produces more verbose output for debugging.

npm run cache:clear

Resets the Redis cache, may result in a duplicate post.

npm test

Runs the test suite.

Footnotes

  1. If set, it will skip the league-wide post. If not set or empty, it will generate posts for all teams with greater than a 0.01% chance. โ†ฉ