Skip to content
Utility for posting Crystal Blog updates to Discord webhooks
Crystal Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
bin
spec
src Add small safety for first-time run Aug 13, 2019
.editorconfig
.gitignore
LICENSE
README.md
shard.lock
shard.yml

README.md

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

You can’t perform that action at this time.