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

from="$_prefix"
to="$1"; shift
msg="$*"
date=$(date)

# TODO tell now, if already joined
printf '%s %s <%s> %s\n' "$to" "$from" "$date" "$msg" >> "$state_file"

echo 'Consider it noted.' # that's what lambdabot says...