From 6178611e979e2b6bfc5c7f07dbcaeb85e8850bac Mon Sep 17 00:00:00 2001 From: PrincessPi3 Date: Sat, 23 Aug 2025 18:31:32 -0600 Subject: [PATCH] better webhoo echo -e \nExisting Webhook and Tag found. Using those values unless you enter new ones.\n --- customscripts/configure_webhook.sh | 5 +++-- customscripts/webhook | 11 ++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/customscripts/configure_webhook.sh b/customscripts/configure_webhook.sh index 5763393..dc886b3 100644 --- a/customscripts/configure_webhook.sh +++ b/customscripts/configure_webhook.sh @@ -23,10 +23,11 @@ fi echo -e "\nConfigure Discord Webhook Settings" if [ -f /tmp/tag.txt ] && [ -f /tmp/webhook.txt ]; then + echo -e "\nExisting Webhook and Tag found. Using those values unless you enter new ones.\n" + existing_webhook=$(cat /tmp/webhook.txt) existing_tag=$(cat /tmp/tag.txt) - - echo -e "\nExisting Webhook and Tag found. Using those values unless you enter new ones.\n" + echo -e "Existing Webhook URL: $existing_webhook" echo -e "Existing Tag: $existing_tag\n" diff --git a/customscripts/webhook b/customscripts/webhook index a30b3a1..b5f1d45 100644 --- a/customscripts/webhook +++ b/customscripts/webhook @@ -1,7 +1,11 @@ #!/bin/bash +# usage: webhook [message/mode] [notify] +## webhook bootup # for bootup mode +## webhook "silly soemething" # for normal webhook message +## webhook "silly osmething" true # to ping with normal message # usage in cron ## @reboot bash /usr/share/customscripts/ifnet "/usr/share/customscripts/webhook bootup" -# discord_webhook="https://discord.com/api/webhooks/yourwebhook" + discord_webhook=$(cat /usr/share/customscripts/webhook.txt) ipaddr=$(hostname -I | grep -E -o "10.0.0.[0-9]{1,3}" | tr '\n' ' ') date=$(date "+%d/%m/%Y %H:%M:%S %Z (%s)") @@ -19,6 +23,11 @@ else content="$1" fi +# any value in $2 will do ping mode +if [ ! -z $2 ]; then + content+="\n$tag" +fi + post_data() { cat <