diff --git a/rowbot b/rowbot index bf49fe2..25012cd 100755 --- a/rowbot +++ b/rowbot @@ -1,5 +1,23 @@ #!/usr/bin/env bash +### +# stats +### + +if [[ ! -v START_TIME ]]; then + export START_TIME + printf -v START_TIME '%(%s)T' -1 +fi + +if [[ -v RELOADED ]]; then + (( RELOADED += 1 )) +else + export RELOADED=0 +fi + +export LAST_RELOAD +printf -v LAST_RELOAD '%(%s)T' -1 + ### # switch toggler ### @@ -939,6 +957,11 @@ hook_cmd_control_panel() { read -r msg <<< "$msg" privmsg "$recipient" "$msg" privmsg "$to" "sent message to $recipient" + ;; + stats) + privmsg "$to" "running since $(printf '%(%c)T' "$START_TIME")" + privmsg "$to" "last reload at $(printf '%(%c)T' "$LAST_RELOAD")" + privmsg "$to" "reloaded $RELOADED times" esac }