Merge branch 'main' of ssh://docker.sq.lan:3022/Bash/Discord_webhook

This commit is contained in:
justine 2025-02-11 11:34:44 +01:00
commit f1420b7ef2

View File

@ -1,15 +1,19 @@
#!/bin/bash
WEBHOOK='https://discord.com/api/webhooks/1338109049413308526/YOURWEBHOOKHEREDARLING'
begin="Command result:
\`\`\`
"
ending="
\`\`\`
<@635539351324983374>
-# Sent from $(hostname) @ $(date)"
#Read from pipe
while read content;
do
MSG=$(jq -n -r --arg msg "$content $ending" '{content: $msg}')
echo $MSG
MSG=$(jq -n -r --arg msg "$begin$content$ending" '{content: $msg}')
done
curl -X POST -H "Content-Type: application/json" --data "$MSG" $WEBHOOK
curl -X POST -H "Content-Type: application/json" --data "$MSG" $WEBHOOK