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

feat(telegram-bots): add bot for ancient greek word of the day

This commit is contained in:
2021-05-21 08:14:43 +02:00
parent e34aecaa66
commit 83fb13d541
2 changed files with 18 additions and 0 deletions

View File

@@ -24,6 +24,7 @@ in {
./autorenkalender.nix
./proverb.nix
./nachtischsatan.nix
./tlg-wotd.nix
<niveum/modules/telegram-bot.nix>
];

View File

@@ -0,0 +1,17 @@
{ pkgs, lib, ... }:
{
niveum.telegramBots.tlg-wotd = {
enable = true;
time = "8:00";
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";
};
}