Merge pull request 'Rowbot Enhancements' (#14) from rowbot-enhanced into master
Reviewed-on: #14
This commit is contained in:
commit
3fb52e90fc
1 changed files with 26 additions and 26 deletions
|
@ -1,27 +1,26 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
###
|
###
|
||||||
# stats
|
# lore
|
||||||
###
|
###
|
||||||
|
|
||||||
if [[ ! -v START_TIME ]]; then
|
export LORE_THIS_RELOAD
|
||||||
export START_TIME
|
printf -v LORE_THIS_RELOAD '%(%s)T' -1
|
||||||
printf -v START_TIME '%(%s)T' -1
|
|
||||||
|
if [[ ! -v LORE_START_TIME ]]; then
|
||||||
|
export LORE_START_TIME=$LORE_THIS_RELOAD
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -v RELOADED ]]; then
|
if [[ ! -v LORE_LONGEST_LIFE ]]; then
|
||||||
(( RELOADED += 1 ))
|
export LORE_LONGEST_LIFE=0
|
||||||
|
elif (( LORE_LONGEST_LIFE < SECONDS )); then
|
||||||
|
export LORE_LONGEST_LIFE=$SECONDS
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -v LORE_LIVES ]]; then
|
||||||
|
(( LORE_LIVES += 1 ))
|
||||||
else
|
else
|
||||||
export RELOADED=0
|
export LORE_LIVES=1
|
||||||
fi
|
|
||||||
|
|
||||||
export LAST_RELOAD
|
|
||||||
printf -v LAST_RELOAD '%(%s)T' -1
|
|
||||||
|
|
||||||
if [[ ! -v LONGEST_LIFE ]]; then
|
|
||||||
export LONGEST_LIFE=0
|
|
||||||
elif (( LONGEST_LIFE < SECONDS )); then
|
|
||||||
export LONGEST_LIFE=$SECONDS
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
###
|
###
|
||||||
|
@ -431,8 +430,8 @@ config-reload() {
|
||||||
export "${env_var^^}"="${!env_var}"
|
export "${env_var^^}"="${!env_var}"
|
||||||
done
|
done
|
||||||
|
|
||||||
if (( SECONDS > LONGEST_LIFE )); then
|
if (( SECONDS > LORE_LONGEST_LIFE )); then
|
||||||
export LONGEST_LIFE=$SECONDS
|
export LORE_LONGEST_LIFE=$SECONDS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
info "reloading rowbot"
|
info "reloading rowbot"
|
||||||
|
@ -1012,8 +1011,8 @@ hook_cmd_control_panel() {
|
||||||
export "${env_var^^}"="${!env_var}"
|
export "${env_var^^}"="${!env_var}"
|
||||||
done
|
done
|
||||||
|
|
||||||
if (( SECONDS > LONGEST_LIFE )); then
|
if (( SECONDS > LORE_LONGEST_LIFE )); then
|
||||||
export LONGEST_LIFE=$SECONDS
|
export LORE_LONGEST_LIFE=$SECONDS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
privmsg "$to" "reloading..."
|
privmsg "$to" "reloading..."
|
||||||
|
@ -1059,17 +1058,18 @@ hook_cmd_control_panel() {
|
||||||
privmsg "$recipient" "$msg"
|
privmsg "$recipient" "$msg"
|
||||||
privmsg "$to" "sent message to $recipient"
|
privmsg "$to" "sent message to $recipient"
|
||||||
;;
|
;;
|
||||||
stats)
|
dashboard|lore)
|
||||||
privmsg "$to" "running since $(printf '%(%c)T' "$START_TIME")"
|
declare -p LORE_LONGEST_LIFE
|
||||||
privmsg "$to" "last reload at $(printf '%(%c)T' "$LAST_RELOAD")"
|
privmsg "$to" "legend began on $(printf '%(%c)T' "$LORE_START_TIME")"
|
||||||
|
privmsg "$to" "this life began on $(printf '%(%c)T' "$LORE_THIS_RELOAD")"
|
||||||
|
|
||||||
if (( LONGEST_LIFE > SECONDS )); then
|
if (( LORE_LONGEST_LIFE > SECONDS )); then
|
||||||
privmsg "$to" "longest life so far is $(seconds "$LONGEST_LIFE")"
|
privmsg "$to" "longest life so far was $(seconds "$LORE_LONGEST_LIFE")"
|
||||||
else
|
else
|
||||||
privmsg "$to" "longest life so far is $(seconds "$SECONDS") (this one)"
|
privmsg "$to" "longest life so far is $(seconds "$SECONDS") (this one)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
privmsg "$to" "reloaded $RELOADED times"
|
privmsg "$to" "lived $LORE_LIVES times"
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue