diff options
Diffstat (limited to 'krebs/2configs/reaktor2.nix')
-rw-r--r-- | krebs/2configs/reaktor2.nix | 55 |
1 files changed, 44 insertions, 11 deletions
diff --git a/krebs/2configs/reaktor2.nix b/krebs/2configs/reaktor2.nix index 3e88c0899..c1af2d8b4 100644 --- a/krebs/2configs/reaktor2.nix +++ b/krebs/2configs/reaktor2.nix @@ -57,7 +57,8 @@ let arguments = [1]; command = { filename = pkgs.writeDash "confuse" '' - set -efu + set -efux + export PATH=${makeBinPath [ pkgs.coreutils pkgs.curl @@ -66,7 +67,7 @@ let ]} stable_url=$(stable-generate "$@") paste_url=$(curl -Ss "$stable_url" | - curl -Ss https://p.krebsco.de --data-binary @- | + curl -Ss http://p.r --data-binary @- | tail -1 ) echo "$_from: $paste_url" @@ -74,6 +75,31 @@ let }; }; + confuse_hackint = { + pattern = "^!confuse (.*)$"; + activate = "match"; + arguments = [1]; + command = { + filename = pkgs.writeDash "confuse" '' + set -efu + export PATH=${makeBinPath [ + pkgs.coreutils + pkgs.curl + pkgs.gnused + pkgs.stable-generate + ]} + case $_msgtarget in \#*) + stable_url=$(stable-generate "$@") + paste_url=$(curl -Ss "$stable_url" | + curl -Ss https://p.krebsco.de --data-binary @- | + tail -1 + ) + echo "$_from: $paste_url" + esac + ''; + }; + }; + taskRcFile = builtins.toFile "taskrc" '' confirmation=no ''; @@ -135,7 +161,7 @@ let } ''; - systemPlugin = { + systemPlugin = { extra_privmsg_hooks ? [] }: { plugin = "system"; config = { workdir = stateDir; @@ -220,8 +246,8 @@ let osm-restaurants-src = pkgs.fetchFromGitHub { owner = "kmein"; repo = "scripts"; - rev = "66b2068d548d3418c81dd093bba3f80248c68196"; - sha256 = "059sp2lz54iwklswaxv9w703sbm2vv7p0ccig10gsqshriq6v58z"; + rev = "dda381be26abff73a0cf364c6dfff6e1701f41ee"; + sha256 = "sha256-J7jGWZeAULDA1EkO50qx+hjl+5IsUj389pUUMreKeNE="; }; osm-restaurants = pkgs.callPackage "${osm-restaurants-src}/osm-restaurants" {}; in pkgs.writeDash "krebsfood" '' @@ -241,12 +267,11 @@ let longitude=$(echo "$poi" | jq -r .longitude) fi - osm-restaurants --radius "$2" --latitude "$latitude" --longitude "$longitude" \ - | jq -r '"How about \(.tags.name) (https://www.openstreetmap.org/\(.type)/\(.id)), open \(.tags.opening_hours)?"' + restaurant=$(osm-restaurants --radius "$2" --latitude "$latitude" --longitude "$longitude") + printf '%s' "$restaurant" | tail -1 | jq -r '"How about \(.tags.name) (https://www.openstreetmap.org/\(.type)/\(.id)), open \(.tags.opening_hours)?"' ''; }; } - confuse bedger-add bedger-balance hooks.sed @@ -266,7 +291,7 @@ let }; }) (task "agenda") - ]; + ] ++ extra_privmsg_hooks; }; }; @@ -426,7 +451,11 @@ in { ]; }; } - systemPlugin + (systemPlugin { + extra_privmsg_hooks = [ + confuse_hackint + ]; + }) ]; username = "reaktor2"; port = "6697"; @@ -444,7 +473,11 @@ in { ]; }; } - systemPlugin + (systemPlugin { + extra_privmsg_hooks = [ + confuse + ]; + }) ]; username = "reaktor2"; }; |