aboutsummaryrefslogtreecommitdiffstats
path: root/reaktor/commands/tell-on_privmsg
blob: 9206d8cd4195e7610c024fdb7a22a9ed1c7a05b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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...