1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00

feat: celan telegram bot

This commit is contained in:
2022-11-25 11:27:16 +01:00
parent c3c0792d50
commit ce99920054
2 changed files with 36 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
{
pkgs,
lib,
...
}: let
celan = pkgs.fetchzip {
url = "http://c.krebsco.de/celan.tar.gz";
sha256 = "sha256-nA+EwAH2vkeolsy9AoPLEMt1uGKDZe/aPrS95CZvuus=";
};
in {
niveum.telegramBots.celan = {
enable = true;
time = "08:00";
token = lib.strings.fileContents <system-secrets/telegram/kmein.token>;
chatIds = ["@PaulCelan"];
command = toString (pkgs.writers.writeDash "random-celan" ''
cd ${celan}
poem="$(${pkgs.findutils}/bin/find . -type f | ${pkgs.coreutils}/bin/shuf -n1)"
source="$(${pkgs.coreutils}/bin/dirname "$poem" | ${pkgs.gnused}/bin/sed 's#^\./##;s/[-_]/ /g;s!/! !g;s/0\([0-9]\+\)/\1/g')"
cat "$poem"
echo
printf "Aus: %s\n" "$source"
'');
};
systemd.timers.telegram-bot-hesychius.timerConfig.RandomizedDelaySec = "10h";
niveum.passport.services = [
{
title = "Paul Celan Bot";
description = "sends a random poem by Paul Celan to Telegram.";
link = "https://t.me/PaulCelan";
}
];
}

View File

@@ -22,6 +22,7 @@ in {
./smyth.nix
./nachtischsatan.nix
./tlg-wotd.nix
./celan.nix
<niveum/modules/telegram-bot.nix>
];