From 82f774d59d054af79926660ec631529aa26b9bcd Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 23 Nov 2022 16:38:18 +0100 Subject: reaktor2 confuse: use different scripts for different servers --- krebs/2configs/reaktor2.nix | 47 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 9 deletions(-) (limited to 'krebs/2configs') diff --git a/krebs/2configs/reaktor2.nix b/krebs/2configs/reaktor2.nix index 4e1a5d41d..c1af2d8b4 100644 --- a/krebs/2configs/reaktor2.nix +++ b/krebs/2configs/reaktor2.nix @@ -52,6 +52,30 @@ let }; confuse = { + pattern = "^!confuse (.*)$"; + activate = "match"; + arguments = [1]; + command = { + filename = pkgs.writeDash "confuse" '' + set -efux + + export PATH=${makeBinPath [ + pkgs.coreutils + pkgs.curl + pkgs.gnused + pkgs.stable-generate + ]} + stable_url=$(stable-generate "$@") + paste_url=$(curl -Ss "$stable_url" | + curl -Ss http://p.r --data-binary @- | + tail -1 + ) + echo "$_from: $paste_url" + ''; + }; + }; + + confuse_hackint = { pattern = "^!confuse (.*)$"; activate = "match"; arguments = [1]; @@ -64,16 +88,14 @@ let pkgs.gnused pkgs.stable-generate ]} - if [ $_msgtarget = '#krebs' ] || [ $_msgtarget = '#xxx' ]; then + 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" - else - echo "please use me in a public channel" - fi + esac ''; }; }; @@ -139,7 +161,7 @@ let } ''; - systemPlugin = { + systemPlugin = { extra_privmsg_hooks ? [] }: { plugin = "system"; config = { workdir = stateDir; @@ -250,7 +272,6 @@ let ''; }; } - confuse bedger-add bedger-balance hooks.sed @@ -270,7 +291,7 @@ let }; }) (task "agenda") - ]; + ] ++ extra_privmsg_hooks; }; }; @@ -430,7 +451,11 @@ in { ]; }; } - systemPlugin + (systemPlugin { + extra_privmsg_hooks = [ + confuse_hackint + ]; + }) ]; username = "reaktor2"; port = "6697"; @@ -448,7 +473,11 @@ in { ]; }; } - systemPlugin + (systemPlugin { + extra_privmsg_hooks = [ + confuse + ]; + }) ]; username = "reaktor2"; }; -- cgit v1.2.3