Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stephenyeargin/hockey-bot
🏒🤖 Posts latest hockey odds to Mastodon
https://github.com/stephenyeargin/hockey-bot
hockey moneypuck nhl nodejs sports-club-stats
Last synced: 24 days ago
JSON representation
🏒🤖 Posts latest hockey odds to Mastodon
- Host: GitHub
- URL: https://github.com/stephenyeargin/hockey-bot
- Owner: stephenyeargin
- License: mit
- Created: 2024-03-09T22:15:26.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-08-24T03:16:26.000Z (3 months ago)
- Last Synced: 2024-08-24T04:26:37.400Z (3 months ago)
- Topics: hockey, moneypuck, nhl, nodejs, sports-club-stats
- Language: JavaScript
- Homepage: https://botsin.space/@hockeybot
- Size: 5.39 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Hockey Bot
[![Node CI](https://github.com/stephenyeargin/hockey-bot/actions/workflows/nodejs.yml/badge.svg)](https://github.com/stephenyeargin/hockey-bot/actions/workflows/nodejs.yml) [![CodeQL](https://github.com/stephenyeargin/hockey-bot/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/stephenyeargin/hockey-bot/actions/workflows/codeql-analysis.yml)
Posts the latest playoff odds for NHL teams to Mastodon.
## Requirements
* NodeJS >= 16
* Redis server
* [Mastodon API Key](https://docs.joinmastodon.org/client/intro/)May also have [additional requirements for `canvas`](https://github.com/Automattic/node-canvas/blob/master/Readme.md), depending on the operating system.
## Configuration
These values must be set in the running process's environment. You can use a tool like [`dotenv`](https://github.com/motdotla/dotenv) or the newer [`dotenvx`](https://dotenvx.com/).
| Environment Variable | Required? | Description | Example |
| -------------------- | --------- | ----------- | ------- |
| `TEAM_CODE` | No[^1] | 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` |[^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.
## 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.