From 50be40354fd7357cb6f7b385f11d76c88e21431d Mon Sep 17 00:00:00 2001 From: Nick Chambers Date: Sat, 17 Jul 2021 00:38:33 -0500 Subject: [PATCH] Break up the IRC magic --- rowbot | 73 ++++++++++++++++++++++++++++++---------------------------- 1 file changed, 38 insertions(+), 35 deletions(-) diff --git a/rowbot b/rowbot index 47d356f..0bed97d 100755 --- a/rowbot +++ b/rowbot @@ -379,18 +379,43 @@ on_sys_exit_998_net() { } ### -# irc magic (everything required to make the bot part of rowbot functional) +# annoyatron900 - keep alive process ### -magic_annoyatron900() { +annoyatron900() { irc_ping "row your bot gently down the stream" } -on_sys_init_999_magic() { - get_option chan "" +on_sys_before_999_annoyatron900() { + if [[ -v alarm_pid ]]; then + export ALARM_PID=$alarm_pid + fi } -on_sys_first_003_magic() { +on_sys_after_999_annoyatron900() { + trap annoyatron900 USR1 + + if [[ -v ALARM_PID ]]; then + alarm_pid=$ALARM_PID + fi +} + +on_sys_register_999_annoyatron900() { + while true; do + read -rt 10