Merge pull request #36 from AgingOrange/main

Add Discord notification. Rename slacksitename to sitename as they wi…
This commit is contained in:
Jason K 2022-04-06 22:07:56 +08:00 committed by GitHub
commit 88c73e30f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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
ttl="3600" # Set the DNS TTL (seconds)
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
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 \
--data-raw '{
"channel": "'$slackchannel'",
"text" : "'"$slacksitename"' DDNS Update Failed: '$record_name': '$record_identifier' ('$ip')."
"text" : "'"$sitename"' DDNS Update Failed: '$record_name': '$record_identifier' ('$ip')."
}'
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;;
*)
logger "DDNS Updater: $ip $record_name DDNS updated."
@ -104,8 +110,14 @@ case "$update" in
curl -L -X POST $slackuri \
--data-raw '{
"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
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;;
esac