mirror of
https://github.com/kmein/niveum
synced 2026-03-16 10:11:08 +01:00
feat(telegram-bots): add smyth
This commit is contained in:
@@ -19,6 +19,7 @@ in {
|
||||
./astrology.nix
|
||||
./autorenkalender.nix
|
||||
./hesychius.nix
|
||||
./smyth.nix
|
||||
./nachtischsatan.nix
|
||||
./tlg-wotd.nix
|
||||
<niveum/modules/telegram-bot.nix>
|
||||
|
||||
35
configs/telegram-bots/smyth.nix
Normal file
35
configs/telegram-bots/smyth.nix
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
niveum.telegramBots.smyth = {
|
||||
enable = true;
|
||||
time = "08/6:00";
|
||||
token = lib.strings.fileContents <system-secrets/telegram/kmein.token>;
|
||||
chatIds = ["@HerbertWeirSmyth"];
|
||||
command = toString (pkgs.writers.writeDash "random-smyth" ''
|
||||
set -efu
|
||||
|
||||
RANDOM_SECTION=$(
|
||||
${pkgs.curl}/bin/curl -sSL http://www.perseus.tufts.edu/hopper/xmltoc?doc=Perseus%3Atext%3A1999.04.0007%3Asmythp%3D1 \
|
||||
| ${pkgs.gnugrep}/bin/grep -o 'ref="[^"]*"' \
|
||||
| ${pkgs.coreutils}/bin/shuf -n1 \
|
||||
| ${pkgs.gnused}/bin/sed 's/^ref="//;s/"$//'
|
||||
)
|
||||
|
||||
${pkgs.curl}/bin/curl -sSL http://www.perseus.tufts.edu/hopper/text?doc=$RANDOM_SECTION\
|
||||
| ${pkgs.htmlq}/bin/htmlq '#text_main' \
|
||||
| ${pkgs.gnused}/bin/sed 's/<\/\?hr>//g' \
|
||||
| ${pkgs.pandoc}/bin/pandoc -f html -t plain --wrap=none
|
||||
'');
|
||||
};
|
||||
|
||||
niveum.passport.services = [
|
||||
{
|
||||
title = "Herbert Weir Smyth Bot";
|
||||
description = "sends a random section from Smyth's Ancient Greek grammar to Telegram.";
|
||||
link = "https://t.me/HerbertWeirSmyth";
|
||||
}
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user