mirror of
https://github.com/mag37/dockcheck.git
synced 2026-02-15 07:48:14 +01:00
- Added notify_v2.sh wrapper for advanced notification management - Updated Discord and Gotify notification templates for v2 compatibility - Added snooze functionality to prevent duplicate notifications - Added support for multiple notification channels and formats (JSON, CSV, text) - Implemented robust dependency management system with package manager and static binary fallback - Added helper functions: releasenotes(), list_options(), progress_bar() - Improved datecheck() function with proper error handling - Added distro_checker() and binary_downloader() functions - Replaced old dependency checks with modern dependency_check() system
49 lines
1.1 KiB
Bash
49 lines
1.1 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# Discord notification template for podcheck v2
|
|
# Requires: DISCORD_WEBHOOK_URL
|
|
|
|
if [[ -z "${DISCORD_WEBHOOK_URL:-}" ]]; then
|
|
echo "Error: DISCORD_WEBHOOK_URL not configured"
|
|
return 1
|
|
fi
|
|
|
|
# Prepare the Discord message
|
|
if [[ -n "${NOTIFICATION_MESSAGE:-}" ]]; then
|
|
# Format message for Discord - escape quotes and newlines
|
|
discord_content="${NOTIFICATION_MESSAGE}"
|
|
discord_content="${discord_content//\"/\\\"}"
|
|
discord_content="${discord_content//$'\n'/\\n}"
|
|
|
|
# Create Discord webhook payload
|
|
discord_payload=$(cat <<EOF
|
|
{
|
|
"content": "${discord_content}",
|
|
"username": "Podcheck",
|
|
"embeds": [
|
|
{
|
|
"title": "${NOTIFICATION_TITLE:-Podcheck Notification}",
|
|
"description": "${discord_content}",
|
|
"color": 3447003,
|
|
"timestamp": "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)"
|
|
}
|
|
]
|
|
}
|
|
EOF
|
|
)
|
|
|
|
# Send to Discord
|
|
if curl -H "Content-Type: application/json" \
|
|
-d "$discord_payload" \
|
|
"${DISCORD_WEBHOOK_URL}" \
|
|
${CurlArgs:-} &>/dev/null; then
|
|
return 0
|
|
else
|
|
echo "Failed to send Discord notification"
|
|
return 1
|
|
fi
|
|
else
|
|
echo "No notification message provided"
|
|
return 1
|
|
fi
|
|
|