forked from zgrep/happybot
26 lines
541 B
Bash
26 lines
541 B
Bash
#!/usr/bin/env sh
|
|
initn="1"
|
|
maxn="3600"
|
|
|
|
olddate="$(date +%s)"
|
|
n="$initn"
|
|
|
|
while true; do
|
|
nick="happybot"
|
|
if [ -e '/home/zgrep/offtopiabday/hateweekfile' ]; then
|
|
nick="hatebot";
|
|
fi;
|
|
ii/ii -i ~/offtopiabday -e ssl -s irc.libera.chat -p 6697 -n "$nick" -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
|