Added webhook_test function to test Discord and Fluxer webhook URL's

This commit is contained in:
2026-09-25 21:03:10 +01:00
parent faff9fa9a5
commit 34e2a0892c
+47
View File
@@ -517,6 +517,53 @@ alias mkdir-random='mkdir $(cat /dev/urandom | tr -dc "a-zA-Z0-9" | fold -w 50 |
#fi
#}
## A function to test if Discord and Fluxer webhook URL's work
webhook_test() {
local webhook_url=$1
if [ -z "$webhook_url" ]; then
echo "Usage: discord_webhook_test <webhook_url>"
return 1
fi
local payload=$(cat <<EOF
{
"embeds": [
{
"title": "🧪 Test Notification",
"description": "This is a test message from the command line",
"color": 3447003,
"fields": [
{
"name": "Timestamp",
"value": "$(date -u '+%Y-%m-%d %H:%M:%S UTC')",
"inline": true
},
{
"name": "From Host",
"value": "$(hostname)",
"inline": true
}
],
"footer": {
"text": "Webhook Test"
}
}
]
}
EOF
)
if curl -s -X POST "$webhook_url" \
-H 'Content-Type: application/json' \
-d "$payload" > /dev/null 2>&1; then
echo "✓ Test notification sent successfully"
else
echo "✗ Failed to send test notification"
return 1
fi
}
## yt-dlp
## yt-dlp Default Limit
alias yt-dlp-limit="yt-dlp --limit-rate 5M -f 137+140 $1"