Make /cv more robust

Hello 2021! May you be better than last year :)
This commit is contained in:
Michael De Roover 2021-01-01 00:03:16 +01:00
parent bdda6db5ee
commit 3e23671fd8
Signed by: vim
GPG Key ID: 075496E232CE04CB

View File

@ -50,10 +50,15 @@ alive(){
} }
cv(){ cv(){
stats=$(curl -sL corona.lmao.ninja/v2/countries/$args) stats=$(curl -sL "corona.lmao.ninja/v2/countries/$args")
country=$(jq -r '.country' <<< $stats) country=$(jq -r '.country' <<< $stats)
cases=$(jq -r '.todayCases' <<< $stats) cases=$(jq -r '.todayCases' <<< $stats)
if [ "$(jq -r '.message' <<< $stats)" != "null" ]
then
sendmsg "This country doesn't have any stats!"
else
sendmsg "Today's COVID-19 cases for $country: $cases. Stay safe!" sendmsg "Today's COVID-19 cases for $country: $cases. Stay safe!"
fi
} }
id(){ id(){