Support multiple command arguments

This commit is contained in:
Michael De Roover 2020-12-26 13:48:27 +01:00
parent be3fd21c1a
commit 284aea57dc
Signed by: vim
GPG Key ID: 075496E232CE04CB

View File

@ -3,7 +3,8 @@ printf "Content-Type: text/plain\n\n"
input=$(cat /dev/stdin)
token=1493641835:AAGR7kLksUIjcrM-PXiVEM_yxLGqLGRWKZA
cmd=($(jq -r '.message.text' <<< $input))
cmd=$(jq -r '.message.text' <<< $input)
args=$(cut -d" " -f2- <<< $cmd)
chat=$(jq -r '.message.chat.id' <<< $input)
user=$(jq -r '.message.from.username' <<< $input)
@ -33,7 +34,7 @@ stat(){
}
cv(){
stats=$(curl -sL corona.lmao.ninja/v2/countries/${cmd[1]})
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!"