Add date and logic for zero cases to /cv

This commit is contained in:
2021-02-10 16:47:23 +01:00
parent 422e807288
commit 662116ae39

View File

@@ -87,9 +87,15 @@ cv(){
cases=$(jq -r '.todayCases' <<< $stats)
pm=$(jq -r '.testsPerOneMillion' <<< $stats)
pct=$(echo "scale = 2; $pm / 10000" | bc)
if [ "$cases" == "0" ]
then
updated="Perhaps the stats are not updated yet?"
fi
if jq -re '.country' <<< $stats
then
sendmsg "Today's COVID-19 cases for $country: $cases \($pct% of the population tested\). Stay safe!"
sendmsg "Today's COVID-19 cases for $country: $cases \($pct% of the population tested\). Stay safe!
Queried at $(date +'%Y-%m-%d %H:%M') CET.
$updated"
else
sendmsg "This country doesn't have any stats!"
fi