Convert arguments to array

This commit is contained in:
Michael De Roover 2021-02-07 15:09:36 +01:00
parent 16897ba7ec
commit aaff6f0b60
Signed by: vim
GPG Key ID: 075496E232CE04CB

View File

@ -83,7 +83,7 @@ alive(){
} }
cv(){ cv(){
stats=$(curl -s "https://corona.lmao.ninja/v2/countries/$args") stats=$(curl -s "https://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)
pm=$(jq -r '.testsPerOneMillion' <<< $stats) pm=$(jq -r '.testsPerOneMillion' <<< $stats)
@ -101,18 +101,18 @@ id(){
} }
ud(){ ud(){
enc=$(echo "$args" | sed "s/\ /%20/g") enc=$(echo "${args[*]}" | sed "s/\ /%20/g")
res=$(curl -s "https://api.urbandictionary.com/v0/define?term=$enc") res=$(curl -s "https://api.urbandictionary.com/v0/define?term=$enc")
if jq -re '.list[0].definition' <<< $res if jq -re '.list[0].definition' <<< $res
then then
def=$(jq -r '.list[0].definition' <<< $res | sed "s/[][]//g") def=$(jq -r '.list[0].definition' <<< $res | sed "s/[][]//g")
sam=$(jq -r '.list[0].example' <<< $res | sed "s/[][]//g") sam=$(jq -r '.list[0].example' <<< $res | sed "s/[][]//g")
sendmsg "*Definition for __${args}__:* sendmsg "*Definition for __${args[*]}__:*
$(escape "()" "$def") $(escape "()" "$def")
*Example:* *Example:*
$(escape "()" "$sam")" $(escape "()" "$sam")"
else else
sendmsg "No definition found for $args." sendmsg "No definition found for ${args[*]}."
fi fi
} }
@ -138,7 +138,7 @@ mp3(){
tmp="/tmp/mp3" tmp="/tmp/mp3"
[ ! -d $tmp ] && mkdir $tmp [ ! -d $tmp ] && mkdir $tmp
sendmsg "Downloading, this might take a while..." sendmsg "Downloading, this might take a while..."
youtube-dl -f 140 --max-filesize 50M -o "$tmp/%(title)s.%(ext)s" "$args" youtube-dl -f 140 --max-filesize 50M -o "$tmp/%(title)s.%(ext)s" "${args[*]}"
rm $tmp/*.part rm $tmp/*.part
if [ -f $tmp/* ] if [ -f $tmp/* ]
then then
@ -161,8 +161,8 @@ stat(){
term(){ term(){
admin admin
sendmsg "\`$(whoami)@${HOSTNAME}:${PWD}$\` \`$args\` sendmsg "\`$(whoami)@${HOSTNAME}:${PWD}$\` \`${args[*]}\`
\`$(echo $args | bash - 2>&1)\`" \`$(echo ${args[*]} | bash - 2>&1)\`"
} }
4c(){ 4c(){