diff options
Diffstat (limited to 'krebs/2configs/reaktor2.nix')
-rw-r--r-- | krebs/2configs/reaktor2.nix | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/krebs/2configs/reaktor2.nix b/krebs/2configs/reaktor2.nix index 13b59fa82..11aaf876a 100644 --- a/krebs/2configs/reaktor2.nix +++ b/krebs/2configs/reaktor2.nix @@ -64,8 +64,7 @@ let pkgs.curl pkgs.stable-generate ]} - stable_url=$(stable-generate "$@") - paste_url=$(curl -Ss "$stable_url" | + paste_url=$(stable-generate "$@" | curl -Ss http://p.r --data-binary @- | tail -1 ) @@ -73,6 +72,22 @@ let ''; }; }; + interrogate = { + pattern = "^!interrogate (.*)$"; + activate = "match"; + arguments = [1]; + command = { + filename = pkgs.writeDash "interrogate" '' + set -efux + + export PATH=${makeBinPath [ + pkgs.stable-interrogate + ]} + caption=$(stable-interrogate "$@") + echo "$_from: $caption" + ''; + }; + }; confuse_hackint = { pattern = "^!confuse (.*)$"; @@ -87,8 +102,7 @@ let pkgs.stable-generate ]} case $_msgtarget in \#*) - stable_url=$(stable-generate "$@") - paste_url=$(curl -Ss "$stable_url" | + paste_url=$(stable-generate "$@" | curl -Ss https://p.krebsco.de --data-binary @- | tail -1 ) @@ -132,7 +146,7 @@ let command = 1; arguments = [2]; env.TASKDATA = "${stateDir}/${name}"; - commands = { + commands = rec { add.filename = pkgs.writeDash "${name}-task-add" '' ${pkgs.taskwarrior}/bin/task rc:${taskRcFile} add "$1" ''; @@ -145,6 +159,7 @@ let delete.filename = pkgs.writeDash "${name}-task-delete" '' ${pkgs.taskwarrior}/bin/task rc:${taskRcFile} delete "$1" ''; + del = delete; done.filename = pkgs.writeDash "${name}-task-done" '' ${pkgs.taskwarrior}/bin/task rc:${taskRcFile} done "$1" ''; @@ -289,7 +304,18 @@ let longitude=$(echo "$poi" | jq -r .longitude) fi - restaurant=$(osm-restaurants --radius "$2" --latitude "$latitude" --longitude "$longitude") + for api_endpoint in \ + https://lz4.overpass-api.de/api/interpreter \ + https://z.overpass-api.de/api/interpreter \ + https://maps.mail.ru/osm/tools/overpass/api/interpreter \ + https://overpass.openstreetmap.ru/api/interpreter \ + https://overpass.kumi.systems/api/interpreter + do + restaurant=$(osm-restaurants --endpoint "$api_endpoint" --radius "$2" --latitude "$latitude" --longitude "$longitude") + if [ "$?" -eq 0 ]; then + break + fi + done printf '%s' "$restaurant" | tail -1 | jq -r '"How about \(.tags.name) (https://www.openstreetmap.org/\(.type)/\(.id)), open \(.tags.opening_hours)?"' ''; }; @@ -297,6 +323,7 @@ let bedger-add bedger-balance hooks.sed + interrogate say (generators.command_hook { inherit (commands) dance random-emoji nixos-version; |