Update /cv command

This commit is contained in:
2021-03-03 00:14:38 +01:00
parent 7184cc2110
commit 4abc7015b1

View File

@@ -123,12 +123,17 @@ cv(){
fi
if [ ! -z ${cv[1]} ]
then
pct(){ bc <<< "scale = 2; $1 / 10000"; }
pct(){ bc <<< "scale = 2; $1 * $2 / $3"; }
mil(){ bc <<< "scale = 3; $1 / 1000000"; }
kil(){ bc <<< "scale = 2; $1 / 1000"; }
sendmsg "*Today's COVID-19 stats for ${cv[1]}:*
Cases: ${cv[4]}
Active: ${cv[9]}
Total: ${cv[3]} \($(pct ${cv[11]})%\)
Tests: ${cv[13]} \($(pct ${cv[14]})%\)
*Cases:* ${cv[4]}
*Active:* $(kil ${cv[9]})k
*Deaths:* ${cv[6]}
\($(kil ${cv[5]})k t, $(pct 100 ${cv[5]} ${cv[3]})% c, $(pct 100 ${cv[5]} ${cv[15]})% p\)
*Total:* $(kil ${cv[3]})k \($(pct 1 ${cv[11]} 10000)%\)
*Tests:* $(mil ${cv[13]})M \($(pct 1 ${cv[14]} 10000)%\)
*Population:* $(mil ${cv[15]})M
Queried at $(date +'%Y-%m-%d %H:%M %Z').
Stay safe and get yourself vaccinated!