2021-05-21 08:14:43 +02:00
|
|
|
{
|
2022-03-10 21:52:12 +01:00
|
|
|
pkgs,
|
|
|
|
|
lib,
|
2023-02-22 10:02:55 +01:00
|
|
|
config,
|
2022-03-10 21:52:12 +01:00
|
|
|
...
|
|
|
|
|
}: {
|
2021-05-21 08:14:43 +02:00
|
|
|
niveum.telegramBots.tlg-wotd = {
|
|
|
|
|
enable = true;
|
2021-05-21 10:01:13 +02:00
|
|
|
time = "9:30";
|
2022-03-10 21:52:12 +01:00
|
|
|
chatIds = ["@tlgwotd"];
|
2023-02-22 10:02:55 +01:00
|
|
|
tokenFile = config.age.secrets.telegram-token-kmein.path;
|
2021-05-21 08:14:43 +02:00
|
|
|
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 '
|
2022-10-28 07:45:33 +02:00
|
|
|
"*\(.word)* '\'''\(.definition | sub("<.*>"; "") | rtrimstr(" "))'\'''\n\nFirst occurrence: \(.firstOccurrence)\nNumber of occurrences: \(.totalOccurrences)"
|
2021-05-21 08:14:43 +02:00
|
|
|
'
|
|
|
|
|
'');
|
|
|
|
|
parseMode = "Markdown";
|
|
|
|
|
};
|
2022-05-22 11:47:59 +02:00
|
|
|
|
|
|
|
|
niveum.passport.services = [
|
|
|
|
|
{
|
|
|
|
|
title = "Thesaurus Linguae Graecae Word of the Day";
|
|
|
|
|
description = "sends <a href=\"https://stephanus.tlg.uci.edu/\">TLG</a>'s word of the day to Telegram.";
|
|
|
|
|
link = "https://t.me/tlgwotd";
|
|
|
|
|
}
|
|
|
|
|
];
|
2021-05-21 08:14:43 +02:00
|
|
|
}
|