#!/usr/bin/bash
if [[ $# -ne 2 ]]; then
echo "Usage: $0 <content> <color>"
exit 1
fi
DISCORD_WEBHOOK_URI="$(cat /home/$USER/Oracle/discord/.webhook | awk -F '=' '{print $2}')"
send_discord_notification() {
payload=$(cat << EOF
{
"embeds": [{
"title": "Alarm",
"description": "$1",
"color": "$2"
}]
}
EOF
)
curl -H "Content-Type: application/json" -X POST -d "$payload" "$DISCORD_WEBHOOK_URI"
}
send_discord_notification "$1" "$2"
#!/bin/bash
discord_url="your_discord_webhook_url"
send_discord_notification() {
local message=$1
local payload=$(cat <<EOF
{
"content": "$message"
}
EOF
)
curl -H "Content-Type: application/json" -X POST -d "$payload" $discord_url
}
send_discord_notification "Hello, World!"