happybot/sortixlaunch
2021-06-19 14:29:28 -04:00

22 lines
446 B
Bash

#!/usr/bin/env sh
initn="1"
maxn="3600"
olddate="$(date +%s)"
n="$initn"
while true; do
ii/ii -i ~/offtopiabday -s irc.sortix.org -e ssl -p 6697 -n "happybot" -f 'Happy birthday! By which I mean existential crisis.'
echo "[$(date)] Oh no, ii died."
if [ "$(date +%s)" -lt "$(($olddate + $n + 60))" ]; then
n="$((n * 7 / 2))"
if [ "$n" -gt "$maxn" ]; then
n="$maxn"
fi
else
n="$initn"
fi
olddate="$(date +%s)"
sleep "$n"
done