Support multiple command arguments
This commit is contained in:
@@ -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!"
|
||||
|
Reference in New Issue
Block a user