!seen, parse timestamp

This commit is contained in:
c0dev0id 2023-12-24 15:08:09 +01:00
parent b5cc10a0cc
commit 477d1245f6
1 changed files with 11 additions and 6 deletions

View File

@ -137,14 +137,19 @@ transparenzbericht() {
say "$i: $(cat "$i") Gummipunkte"
done
}
t
seen() {
# TODO the newer ii saves unix timestamps. We could detect that and
# parse it on output (or input)
[ -z "$1" ] && return
[ -f "$BOTDIR/seen/$1" ] \
&& say "$(cat "$BOTDIR/seen/$1")" \
|| say "Hmm, ich habe keine Ahnung wann $1 zum letzten mal online war."
if [ -f "$BOTDIR/seen/$1" ]
then
_l="$(cat "$BOTDIR/seen/$1")"
_ts="$(echo "$_l" cut -d" " -f1)"
_msg="$(echo "$_l" cut -d" " -f2-)"
_dt="$(date -r "$_ts" +"%Y-%m-%d %M:%H")"
say "$_dt $_msg"
else
say "Hmm, ich habe keine Ahnung wann $1 zum letzten mal online war."
fi
}
usage() {