Add Discord notification. Rename slacksitename to sitename as they will probably be the same.

This commit is contained in:
AgingOrange 2022-03-31 07:15:08 +02:00
parent d9ad375827
commit 6af3585c79
1 changed files with 25 additions and 13 deletions

View File

@ -8,10 +8,10 @@ zone_identifier="" # Can be found in the "Overvi
record_name="" # Which record you want to be synced record_name="" # Which record you want to be synced
ttl="3600" # Set the DNS TTL (seconds) ttl="3600" # Set the DNS TTL (seconds)
proxy="false" # Set the proxy to true or false proxy="false" # Set the proxy to true or false
slacksitename="" # Title of site "Example Site" sitename="" # Title of site "Example Site"
slackchannel="" # Slack Channel #example slackchannel="" # Slack Channel #example
slackuri="" # URI for Slack WebHook "https://hooks.slack.com/services/xxxxx" slackuri="" # URI for Slack WebHook "https://hooks.slack.com/services/xxxxx"
discorduri="" # URI for Discord WebHook "https://discordapp.com/api/webhooks/xxxxx"
########################################### ###########################################
@ -94,9 +94,15 @@ case "$update" in
curl -L -X POST $slackuri \ curl -L -X POST $slackuri \
--data-raw '{ --data-raw '{
"channel": "'$slackchannel'", "channel": "'$slackchannel'",
"text" : "'"$slacksitename"' DDNS Update Failed: '$record_name': '$record_identifier' ('$ip')." "text" : "'"$sitename"' DDNS Update Failed: '$record_name': '$record_identifier' ('$ip')."
}' }'
fi fi
if [[ $discorduri != "" ]]; then
curl -i -H "Accept: application/json" -H "Content-Type:application/json" -X POST \
--data-raw '{
"content" : "'"$sitename"' DDNS Update Failed: '$record_name': '$record_identifier' ('$ip')."
}' $discorduri
fi
exit 1;; exit 1;;
*) *)
logger "DDNS Updater: $ip $record_name DDNS updated." logger "DDNS Updater: $ip $record_name DDNS updated."
@ -104,8 +110,14 @@ case "$update" in
curl -L -X POST $slackuri \ curl -L -X POST $slackuri \
--data-raw '{ --data-raw '{
"channel": "'$slackchannel'", "channel": "'$slackchannel'",
"text" : "'"$slacksitename"' Updated: '$record_name''"'"'s'""' new IP Address is '$ip'" "text" : "'"$sitename"' Updated: '$record_name''"'"'s'""' new IP Address is '$ip'"
}' }'
fi fi
if [[ $discorduri != "" ]]; then
curl -i -H "Accept: application/json" -H "Content-Type:application/json" -X POST \
--data-raw '{
"content" : "'"$sitename"' Updated: '$record_name''"'"'s'""' new IP Address is '$ip'"
}' $discorduri
fi
exit 0;; exit 0;;
esac esac