sncf-bot/README.org
2022-09-09 08:32:07 +02:00

2.3 KiB

SNCF Bot

Usage

Get an access to the SNCF API. By creating an account, you should receive an email with your authentication key.

You can now call the program with the authentication key as the first argument.

$ sncf <sncf-key>
┌────────────┬────────────────────────────────┬───────────────┐
│ Réseau     │ Direction                      │ Heure         │
├────────────┼────────────────────────────────┼───────────────┤
│ TRANSILIEN │ Paris Saint-Lazare (Paris)     │ 08:41         │
│ TER        │ Paris Saint-Lazare (Paris)     │ 08:54         │
│ TER        │ Rouen Rive Droite (Rouen)      │ 09:07         │
│ TRANSILIEN │ Paris Saint-Lazare (Paris)     │ 09:41         │
│ TER        │ Paris Saint-Lazare (Paris)     │ 09:55         │
│ TER        │ Paris Saint-Lazare (Paris)     │ 10:58         │
│ TER        │ Rouen Rive Droite (Rouen)      │ 11:05         │
│ TRANSILIEN │ Paris Saint-Lazare (Paris)     │ 11:37         │
│ TER        │ Paris Saint-Lazare (Paris)     │ 12:56         │
│ TER        │ Rouen Rive Droite (Rouen)      │ 13:06         │
└────────────┴────────────────────────────────┴───────────────┘

If you want to publish to Mattermost, create an incoming webhook by going to Product menu (top left) → IntegrationsIncoming webhooks.

Use the --mattermost-url option to set the webhook URL and post to Mattermost. Optionally, you can override the default channel of the webhook with --channel.

Building instructions

The build script will use Docker to build a fully static executable. The Dockerfile is based on the gerbil/alpine image.

$ ./build.sh