Add some stats tracking
This commit is contained in:
parent
d30060e38e
commit
684a59f4f9
1 changed files with 23 additions and 0 deletions
23
rowbot
23
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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue