CEC-list-monitoring/stdin2discord.bash
a31 d3eeec0645
Some checks failed
Push commit / report (push) Failing after 4s
Update stdin2discord.bash
2023-09-09 18:55:00 +03:00

28 lines
403 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"