Display the next departures at any SNCF train station.
Find a file
2022-09-09 22:30:03 +02:00
.gitignore Initial commit 2022-09-08 21:01:55 +02:00
build.sh Add README 2022-09-09 08:32:07 +02:00
Dockerfile Initial commit 2022-09-08 21:01:55 +02:00
LICENSE Add README 2022-09-09 08:32:07 +02:00
README.org Add README 2022-09-09 08:32:07 +02:00
sncf.ss Display unicode and markdown tables with a single function 2022-09-09 22:30:03 +02:00

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