ass/webhook
2025-05-03 12:27:55 -06:00

37 lines
754 B
Bash

#!/bin/sh
# Settings
# Discord Webhook URL (e.g. https://discord.com/api/webhooks/WEBHOOK_ID/TOKEN)
discord_url=""
# Message content (e.g. :newspaper: @everyone A new album has been added!"
message=""
# Embed color (e.g. 45973)
embed_color=""
generate_post_data() {
cat <<EOF
{
"content": "$message",
"embeds": [{
"title": "$albumtitle",
"description": "$albumurl",
"color": "$embed_color",
"thumbnail": {
"url": "$albumcover"
}
}]
}
EOF
}
data="$(latestalbum)"
if [ -z "$data" ]; then
exit 0
fi
albumtitle="$(echo "$data" | sed -n '1p')"
albumurl="$(echo "$data" | sed -n '2p')"
albumcover="$(echo "$data" | sed -n '3p')"
curl -H "Content-Type: application/json" -X POST -d "$(generate_post_data)" $discord_url