From 3e23671fd8d37f5f731be9d528cf4b5d06817e64 Mon Sep 17 00:00:00 2001 From: Michael De Roover Date: Fri, 1 Jan 2021 00:03:16 +0100 Subject: [PATCH] Make /cv more robust Hello 2021! May you be better than last year :) --- konata.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/konata.sh b/konata.sh index de46d5f..a5f4c74 100755 --- a/konata.sh +++ b/konata.sh @@ -50,10 +50,15 @@ alive(){ } cv(){ - stats=$(curl -sL corona.lmao.ninja/v2/countries/$args) + stats=$(curl -sL "corona.lmao.ninja/v2/countries/$args") country=$(jq -r '.country' <<< $stats) cases=$(jq -r '.todayCases' <<< $stats) - sendmsg "Today's COVID-19 cases for $country: $cases. Stay safe!" + 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!" + fi } id(){