From d058cd9e1931b6f0923307b637ca8b282510f552 Mon Sep 17 00:00:00 2001 From: danny28506 Date: Sun, 12 Jan 2025 18:00:00 -0500 Subject: [PATCH] Working with variable inputs... --- push_discord.sh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/push_discord.sh b/push_discord.sh index ce33ac9..57089ac 100644 --- a/push_discord.sh +++ b/push_discord.sh @@ -2,9 +2,9 @@ # # Purpose: Send image and message to a Discord webhook URL that will post the data to a Discord channel. # -# Input parameters: -# 1. Image -# 2. Message +# Input arguments/parameters: +# 1. Image = $1 +# 2. Message = $2 # # Example: # ./scripts/push_processors/push_discord.sh /srv/images/NOAA-18-20210212-091356-MCIR.jpg "test" @@ -15,17 +15,19 @@ # input params DISCORD_WEBHOOK=https://discord.com/api/webhooks/1328127093590196254/4qeyLRUweFwf8bBv_D9fOWq3xSQHzm2HEYZoKB_IyXRHxwd25byaICR3fd6Y2C2tttYQ -IMAGE=/home/danny28506/gitea/Automated_Discord_Image_Pusher/Patch_starfleet_command_2000.png -#MESSAGE=$3 +IMAGE=$1 +MESSAGE=$2 # check that the file exists and is accessible if [ -f "${IMAGE}" ]; then - log "Sending message to Discord webhook" "INFO" - push_log=$(curl -H "Content-Type: multipart/form-data" \ +# log "Sending message to Discord webhook" "INFO" +echo "Sending Message..." +push_log=$(curl -H "Content-Type: multipart/form-data" \ -F file=@$IMAGE \ -F "payload_json={\"content\":\"$MESSAGE\"}" \ $DISCORD_WEBHOOK 2>&1) - log "${push_log}" "INFO" +# log "${push_log}" "INFO" else - log "Could not find or access image/attachment - not sending message to Discord" "ERROR" +# log "Could not find or access image/attachment - not sending message to Discord" "ERROR" +echo "Error..." fi