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

3 Commits

Author SHA1 Message Date
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
6a3add22ed feat(mpv-radio): use dmenu 2021-05-21 08:41:04 +02:00
83fb13d541 feat(telegram-bots): add bot for ancient greek word of the day 2021-05-21 08:25:03 +02:00
3 changed files with 19 additions and 1 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 = "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";
};
}

View File

@@ -315,7 +315,7 @@ in rec {
};
streams-tsv = pkgs.writeText "streams.tsv" (lib.concatMapStringsSep "\n" ({ desc ? "", stream, station, ... }: "${station}\t${desc}\t${stream}") streams);
in pkgs.writers.writeDashBin "mpv-radio" ''
exec ${pkgs.mpv}/bin/mpv "$(${pkgs.fzf}/bin/fzf < ${streams-tsv} | ${pkgs.coreutils}/bin/cut -f3)"
exec ${pkgs.mpv}/bin/mpv --force-window=yes "$(${pkgs.dmenu}/bin/dmenu -i -l 5 < ${streams-tsv} | ${pkgs.coreutils}/bin/cut -f3)"
'';
rfc = wrapScript {