CEC-list-monitoring/stdin2discord.bash
a31 9f7c6d9fed
All checks were successful
Push commit / report (push) Successful in 4s
Use gitea actions for updates (#1)
Reviewed-on: a31/CEC-list-monitoring#1
2023-09-09 19:06:48 +03:00

28 lines
402 B
Bash

#!/bin/bash
set -e
send() {
local _msg=$1
if [[ -z $_msg ]]; then
return
fi
curl -X POST \
-H "Content-Type: application/json" \
-d "{\"content\":\"$_msg\"}" \
"$DISCORD_WEBHOOK"
}
msg=""
while IFS= read -r line; do
if [[ ${#msg}${#line} -ge 2000 ]]; then
send "$msg"
msg=""
else
msg+="$line"
fi
done
send "$msg"