Add feh and viu

This commit is contained in:
HonusBot 2021-05-15 23:39:10 +02:00
parent be9fe9d051
commit 02ad99f4fa

View File

@ -3,22 +3,30 @@
command="$1" command="$1"
shift shift
args="$@" args="$@"
display_command="| display -title \"HonusBot CLI\" -quiet" picture_download_command="cat"
picture_save_to_temp_command="cat"
display_command_pipe="display -title \"HonusBot CLI\" -quiet"
display_command_after="true"
download_url_to_stdin=true download_url_to_stdin=true
if [ -x "$(command -v feh)" ]; then if [ -x "$(command -v viu)" ]; then
display_command="| feh" echo "Found viu"
picture_save_to_temp_command="tee /tmp/temp-honus.bin"
display_command_pipe="cat > /dev/null"
display_command_after="viu /tmp/temp-honus.bin"
download_url_to_stdin=true
elif [ -x "$(command -v feh)" ]; then
echo "Found feh"
display_command_pipe="feh"
display_command_after="true"
download_url_to_stdin=false download_url_to_stdin=false
fi fi
if [ -x "$(command -v viu)" ]; then if [ download_url_to_stdin ]; then
display_command="> /tmp/temp-honus.bin; viu /tmp/temp-honus.bin" echo "Must download url content"
download_url_to_stdin=true picture_download_command="xargs --max-args=1 --no-run-if-empty curl -s --location"
fi fi
if [ download_url_to_stdin = true ]; then 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}"
display_command="| xargs --max-args=1 --no-run-if-empty curl -s --location ${display_command}"
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" ${display_command}
eval "${display_command_after}"