Add useful and not so useful commands to group chats. Reusing business logic so same bot can run on Telegram and Discord.
Commands must be explicitely enabled via an environment variable. E.g., ENABLED_FEATURES=ping;dl.
Downloads video in the link and sends it as a video while deleting the original message if everything succeeds.
Use PROXY_URLS environment variable to provide list of available SOCKS5-proxies to circumvent IP-range restrictions. Videos are stored at YTDLP_TMP_DIR which is cleared periodically.
This command requires yt-dlp to be available at PATH. For downloads to keep working, you should run yt-dlp -U so it is running the latest available release.
If ALWAYS_RE_ENCODE is set to true, videos are always reencoded to H.264 to get rid of VP9/AV1. Fruit phones seem to have issues with these and also the check is not always reliable.
Values are fetched from Suomen Pankki dashboards with Playwright and cached at SQLite db located at DATABASE_FILE. Playwright used because the "official" dashboards available through APIs are not updated as quickly as this one dashboard.
Euribor-korot 04.04.
12 kk: 2.235 %
6 kk: 2.259 %
3 kk: 2.323 %
Dubz. Throws two dice responds in a proper way.
/tuplilla tehdään asia X
dubz: Tuplat tuli 😎, tehdään asia X
no dubz: Ei tuplia 😿, ei tehdä asiaa X
MISTRAL_TOKEN required for this one because we try respond with grammatically correct negation. Sometimes works, sometimes not.
PROXY_URLS="localhost:1235;localhost:1234" \
YTDLP_TMP_DIR=/tmp/yt-dlp \
EURIBOR_GRAPH_DIR=/tmp/euribor \
DATABASE_FILE=/opt/euribor.db \
MISTRAL_TOKEN=<mistral token> \
TELEGRAM_TOKEN=<telegram token> \
ENABLED_FEATURES="ping;dl;euribor;tuplilla" \
go run gpsp-bot.go telegram
DISCORD_TOKEN=<telegram token> \
ENABLED_FEATURES=ping \
go run gpsp-bot.go discord
Container includes yt-dlp at build-time, but see /dl -section why it is useful to mount yt-dlp from host.
podman built -t gpsp-bot .
podman run -v /usr/bin/yt-dlp:/usr/bin/yt-dlp:z \
-e ENABLED_FEATURES="ping;dl" \
-e TELEGRAM_TOKEN=<token> gpsp-bot telegram