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 fi
if [ ! -z ${cv[1]} ] if [ ! -z ${cv[1]} ]
then 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]}:* sendmsg "*Today's COVID-19 stats for ${cv[1]}:*
Cases: ${cv[4]} *Cases:* ${cv[4]}
Active: ${cv[9]} *Active:* $(kil ${cv[9]})k
Total: ${cv[3]} \($(pct ${cv[11]})%\) *Deaths:* ${cv[6]}
Tests: ${cv[13]} \($(pct ${cv[14]})%\) \($(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'). Queried at $(date +'%Y-%m-%d %H:%M %Z').
Stay safe and get yourself vaccinated! Stay safe and get yourself vaccinated!