Support multiple command arguments
This commit is contained in:
parent
be3fd21c1a
commit
284aea57dc
@ -3,7 +3,8 @@ printf "Content-Type: text/plain\n\n"
|
|||||||
input=$(cat /dev/stdin)
|
input=$(cat /dev/stdin)
|
||||||
token=1493641835:AAGR7kLksUIjcrM-PXiVEM_yxLGqLGRWKZA
|
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)
|
chat=$(jq -r '.message.chat.id' <<< $input)
|
||||||
user=$(jq -r '.message.from.username' <<< $input)
|
user=$(jq -r '.message.from.username' <<< $input)
|
||||||
|
|
||||||
@ -33,7 +34,7 @@ stat(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
cv(){
|
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)
|
country=$(jq -r '.country' <<< $stats)
|
||||||
cases=$(jq -r '.todayCases' <<< $stats)
|
cases=$(jq -r '.todayCases' <<< $stats)
|
||||||
sendmsg "Today's COVID-19 cases for $country: $cases. Stay safe!"
|
sendmsg "Today's COVID-19 cases for $country: $cases. Stay safe!"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user