1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00
Files
niveum/configs/telegram-bots/tlg-wotd.nix
Kierán Meinhardt 99a8ecf876 fix(telegram-bots): set TLG bot time to 9:30
the server is set to PST/PDT (Irvine, California) so the new day begins at 9:00 CET/CEST
2021-05-21 10:01:13 +02:00

18 lines
614 B
Nix

{ pkgs, lib, ... }:
{
niveum.telegramBots.tlg-wotd = {
enable = true;
time = "9:30";
token = lib.strings.fileContents <system-secrets/telegram/kmein.token>;
chatIds = [ "@tlgwotd" ];
command = toString (pkgs.writers.writeDash "tlg-wotd" ''
${pkgs.curl}/bin/curl -sSL http://stephanus.tlg.uci.edu/Iris/Wotd \
| ${pkgs.recode}/bin/recode html..utf8 \
| ${pkgs.jq}/bin/jq -r '
"*\(.word)* '\'''\(.definition | rtrimstr(" "))'\'''\n\nFirst occurrence: \(.firstOccurrence)\nNumber of occurrences: \(.totalOccurrences)"
'
'');
parseMode = "Markdown";
};
}