reaktor2 confuse: use different scripts for different servers

This commit is contained in:
lassulus 2022-11-23 16:38:18 +01:00
parent bd6b355a89
commit 82f774d59d

View File

@ -52,6 +52,30 @@ let
}; };
confuse = { 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 (.*)$"; pattern = "^!confuse (.*)$";
activate = "match"; activate = "match";
arguments = [1]; arguments = [1];
@ -64,16 +88,14 @@ let
pkgs.gnused pkgs.gnused
pkgs.stable-generate pkgs.stable-generate
]} ]}
if [ $_msgtarget = '#krebs' ] || [ $_msgtarget = '#xxx' ]; then case $_msgtarget in \#*)
stable_url=$(stable-generate "$@") stable_url=$(stable-generate "$@")
paste_url=$(curl -Ss "$stable_url" | paste_url=$(curl -Ss "$stable_url" |
curl -Ss https://p.krebsco.de --data-binary @- | curl -Ss https://p.krebsco.de --data-binary @- |
tail -1 tail -1
) )
echo "$_from: $paste_url" echo "$_from: $paste_url"
else esac
echo "please use me in a public channel"
fi
''; '';
}; };
}; };
@ -139,7 +161,7 @@ let
} }
''; '';
systemPlugin = { systemPlugin = { extra_privmsg_hooks ? [] }: {
plugin = "system"; plugin = "system";
config = { config = {
workdir = stateDir; workdir = stateDir;
@ -250,7 +272,6 @@ let
''; '';
}; };
} }
confuse
bedger-add bedger-add
bedger-balance bedger-balance
hooks.sed hooks.sed
@ -270,7 +291,7 @@ let
}; };
}) })
(task "agenda") (task "agenda")
]; ] ++ extra_privmsg_hooks;
}; };
}; };
@ -430,7 +451,11 @@ in {
]; ];
}; };
} }
systemPlugin (systemPlugin {
extra_privmsg_hooks = [
confuse_hackint
];
})
]; ];
username = "reaktor2"; username = "reaktor2";
port = "6697"; port = "6697";
@ -448,7 +473,11 @@ in {
]; ];
}; };
} }
systemPlugin (systemPlugin {
extra_privmsg_hooks = [
confuse
];
})
]; ];
username = "reaktor2"; username = "reaktor2";
}; };