Handle errors
This commit is contained in:
parent
ac19fbda21
commit
984413c47c
@ -14,13 +14,11 @@ display_command_after="true"
|
||||
download_url_to_stdin=true
|
||||
|
||||
if [ -x "$(command -v viu)" ]; then
|
||||
echo "Found viu"
|
||||
picture_save_to_temp_command="tee ${temp_path}/temp-honus.bin"
|
||||
display_command_pipe="cat > /dev/null"
|
||||
display_command_after="viu ${temp_path}/temp-honus.bin"
|
||||
download_url_to_stdin=true
|
||||
elif [ -x "$(command -v feh)" ]; then
|
||||
echo "Found feh"
|
||||
display_command_pipe="xargs --max-args=1 --no-run-if-empty feh --title \"HonusBot CLI\" --auto-zoom"
|
||||
display_command_after="true"
|
||||
download_url_to_stdin=false
|
||||
@ -31,6 +29,10 @@ if [ "$download_url_to_stdin" = true ]; then
|
||||
picture_download_command="xargs --max-args=1 --no-run-if-empty curl -s --location"
|
||||
fi
|
||||
|
||||
curl -s --location --request POST 'https://api.ignuranza.net/remote-command-api/command' --header 'Content-Type: application/json' --header 'User-Agent: RcAPI/1.2' --data-raw "{\"botName\": \"AstralNetworkHonusBot\", \"botPassword\": \"KixdujXD37898ZSy893\", \"command\": \"${command}\", \"replyToUserId\": 0, \"senderUserId\": 1237252783, \"chatId\": 1237252783, \"queryText\": \"$args\", \"rawSingleArgument\": false}" | jq -r ".imageUrl" | eval "${picture_download_command}" | eval "${picture_save_to_temp_command}" | eval "${display_command_pipe}"
|
||||
{ # try
|
||||
curl -s --location --request POST 'https://api.ignuranza.net/remote-command-api/command' --header 'Content-Type: application/json' --header 'User-Agent: RcAPI/1.2' --data-raw "{\"botName\": \"AstralNetworkHonusBot\", \"botPassword\": \"KixdujXD37898ZSy893\", \"command\": \"${command}\", \"replyToUserId\": 0, \"senderUserId\": 1237252783, \"chatId\": 1237252783, \"queryText\": \"$args\", \"rawSingleArgument\": false}" | jq -r ".imageUrl" | eval "${picture_download_command}" | eval "${picture_save_to_temp_command}" | eval "${display_command_pipe}" &&
|
||||
eval "${display_command_after}"
|
||||
} 2>/dev/null || { # catch
|
||||
echo "Error/Not found"
|
||||
}
|
||||
|
||||
eval "${display_command_after}"
|
||||
|
Loading…
Reference in New Issue
Block a user