Merge branch 'pm' of uplime/rowbot into master

This commit is contained in:
Nicholas Chambers 2021-06-19 07:32:43 +00:00 committed by Gogs
commit 9a73e6f8cc
1 changed files with 22 additions and 21 deletions

43
rowbot
View File

@ -117,11 +117,11 @@ fi
###
cleanup() {
if [[ -v $tls_pid || $tls = no ]]; then
if [[ -v tls_pid || $tls = no ]]; then
exec {in_sock}>&- {out_sock}>&- {log}>&-
fi
if [[ -v $tls_pid ]]; then
if [[ -v tls_pid ]]; then
kill "$tls_pid"
rm -rf "$sock_dir"
fi
@ -133,6 +133,17 @@ cleanup() {
trap cleanup EXIT
alarm-handler() {
ping "row your bot gently down the stream"
if [[ $keep_trying = yes ]]; then
info "trying for %s again" "$desired_nick"
nick "$desired_nick"
fi
}
trap alarm-handler ALRM
###
# reload code
###
@ -272,10 +283,14 @@ on_001() {
join "$chan"
fi
while true; do
kill -ALRM "$$"
sleep 10
done &
{
debug "timer pid is %d" "$BASHPID"
while true; do
kill -ALRM "$$"
sleep 10
done
} &
ping_pid=$!
nick=${params[0]}
@ -477,21 +492,6 @@ who() {
fi
}
###
# keepalive code
###
alarm-handler() {
ping "row your bot gently down the stream"
if [[ $keep_trying = yes ]]; then
info "trying for %s again" "$desired_nick"
nick "$desired_nick"
fi
}
trap alarm-handler ALRM
###
# app hooks
##
@ -709,6 +709,7 @@ if [[ $reload = yes ]]; then
privmsg "$RELOAD_TO" done.
else
registered=no
info "rowbot's pid is %d" "$$"
nick "$nick"
user "$ident" "$realname"
fi