summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/simple/Reaktor/scripts/tell-on_privmsg.sh
diff options
context:
space:
mode:
Diffstat (limited to 'krebs/5pkgs/simple/Reaktor/scripts/tell-on_privmsg.sh')
-rwxr-xr-xkrebs/5pkgs/simple/Reaktor/scripts/tell-on_privmsg.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/krebs/5pkgs/simple/Reaktor/scripts/tell-on_privmsg.sh b/krebs/5pkgs/simple/Reaktor/scripts/tell-on_privmsg.sh
new file mode 100755
index 000000000..fc05bdefb
--- /dev/null
+++ b/krebs/5pkgs/simple/Reaktor/scripts/tell-on_privmsg.sh
@@ -0,0 +1,18 @@
+#! /bin/sh
+set -euf
+
+# require flock from util-linux
+if test "${FLOCK-}" != "$state_file"; then
+ exec env FLOCK="$state_file" flock "$state_file" "$0" "$@"
+fi
+
+# TODO tell now, if already joined
+jq -cn \
+ --arg from "$_from" \
+ --arg to "${1%% *}" \
+ --arg text "${1#* }" \
+ --arg msgtarget "$_msgtarget" \
+ '{ $from, $to, $text, $msgtarget, date: (now | todate) }' \
+ >> "$state_file"
+
+echo 'Consider it noted.' # that's what lambdabot says...