[go: up one dir, main page]

Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.
/ bahn-bot Public archive

German telegram bot as notification in case of train delays

License

Notifications You must be signed in to change notification settings

PKuebler/bahn-bot

Repository files navigation

Bahn Bot

German telegram bot as notification in case of train delays. It's use marudor.de as hafas api.

GitHub Travis (.org) Docker Image Version (latest semver) MicroBadger Layers Docker Image Size (tag) Docker Automated build Docker Build Status

Features

  • Beobachte Züge
  • Individuelle Schwellwerte

Commands

  • /help Befehlsübersicht
  • /myalarms Alle gesetzten Verspätungsalarme
  • /newalarm Neuer Verspätungsalarm
  • /cancel Abbrechen des aktuellen Vorgangs

Config

All parameters can be overwritten by ENV variable.

// config.json
{
    "api": {
        "endpoint": "https://marudor.de/api"
    },
    "telegram": {
        "key": ""
    },
    "database": {
        "dialect": "postgres",
        "path": "host=myhost port=myport user=gorm dbname=gorm password=mypassword"
    },
    "loglevel": "trace",
    "metrics": false
}
  • API_ENDPOINT marudor endpoint
  • TELEGRAM_KEY telegram bot key from Telegram BotFahter
  • DB_DIALECT currently only mysql or postgres
  • DB_PATH database config path.
    • mysql
      • user:password@/dbname?charset=utf8&parseTime=True&loc=Local
    • postgres
      • sslmode=disable host=myhost port=myport user=gorm dbname=gorm password=mypassword
  • LOG_LEVEL loglevel info, trace, warn or error

Docker Setup

version: '3'
services:
  bot:
    image: "pkuebler/bahn-bot:latest"
    environment:
        - API_ENDPOINT=https://marudor.de/api
        - TELEGRAM_KEY=
        - DB_DIALECT=mysql
        - "DB_PATH=user:password@/dbname?charset=utf8&parseTime=True&loc=Local"
        - LOG_LEVEL=info

Prometheus Endpoint

The Prometheus endpoint is located under :8080/metrics when enable_metrics is enabled in the Config.

ONLY for local tests a docker-compose overwrite file is included.

docker-compose -f docker-compose.yml -f docker-compose.prometheus.yml up

You can reach Prometheus on port 9090.

DSGVO

  • Speichert:
    • ChatID + Zug für den Verspätungsalarm. Wird 2 Tage nach Ankunft des Zuges gelöscht (um Verspätungen abzufangen).
    • ChatID + Aktuelle Operation mit Bot (z.B. newalarm, savealarm, ...). Wird 4 Tage nach letzter Interaktion gelöscht.
    • Metrics erfassen verwendung von Zugnummern ohne Verknüpfungen zu Personen.

ToDo

  • Add interface > telegram tests
  • SQL Database Repository tests

License

MIT