Make the bot work with a new ii versions

This commit is contained in:
c0dev0id 2023-02-05 10:09:45 +01:00
parent c7a3c4a7c0
commit c1731d0c5d
1 changed files with 10 additions and 0 deletions

View File

@ -139,6 +139,8 @@ transparenzbericht() {
}
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")" \
@ -196,6 +198,14 @@ do
NICK=$(echo "$line" \
| sed -n 's/^....-..-.. ..:.. <\([^>]*\).*/\1/p')
if [ -z "$NICK" ]
then
# the newer ii is using unix timestamps
NICK=$(echo "$line" \
| sed -n 's/^[0-9]* <\([^>]*\).*/\1/p')
fi
# prevent loops; so the bot can't trigger itself.
[ "$NICK" == "$BOTNICK" ] \
&& continue