crystal-news

Utility for posting Crystal Blog updates to Discord webhooks

crystal-news

Small application for posting articles from the Crystal Blog to Discord webhooks.

This is intended to be run on a cron. It works by reading a configured directory that is a clone of crystal-website, scans it for markdown files, and parses the markdown files to send notifications to Discord webhooks. An identifier for the last post sent to Discord is simply serialized to a text file and used the next time the application is run to pick up on any new posts.

Setup

Build

Clone the repo and run shards build.

Configuration

Specify config.json:

Field Type Description
post-path string The directory the runtime should look for markdown files in. This should always be ./crystal-website/_posts.
post_record_path string The name of the file to save the name of the last read post to.
webhooks array of strings A list of Discord webhooks to distribute posts to.

Example

{
  "post_path": "./crystal-website/_posts",
  "post_record_path": "last_post.txt",
  "webhooks": [
    ".. Discord webhook URLs here .."
  ]
}

This config should be placed in the same directory as run.sh and the crystal-news binary.

Running

Run bin/run.sh.

Both config.json and the crystal-news binary should be in the same directory as the script.

  • If config.json is not found, it will fall back to ENV[WEBHOOK_URL] (single URL)

  • If the crystal-news binary is not found, the script will abort.

Contributors

Owner
github statistic
  • 3
  • 0
  • 1
  • 1
  • over 1 year ago
  • August 13, 2019
License

MIT License

Links
Synced at

Thu, 13 May 2021 13:47:22 GMT