update config

This commit is contained in:
2025-01-22 18:17:08 +07:00
parent aee01f1ca5
commit c2fe93675e
+18 -6
View File
@@ -181,16 +181,28 @@ jobs:
${APKS} ${APKS}
" "
# Function to send messages in chunks # Function to split messages by line and send them
send_discord_message() { send_discord_message() {
local message="$1" local message="$1"
while [ ${#message} -gt 0 ]; do local buffer=""
local chunk="${message:0:2000}" # Take the first 2000 characters while IFS= read -r line || [ -n "$line" ]; do
# Check if adding the current line exceeds 2000 characters
if [ ${#buffer} -ge 2000 ]; then
# Send the current buffer and reset it
curl -X POST -H "Content-Type: application/json" \
-d "$(jq -n --arg content "$buffer" '{content: $content}')" \
"$DISCORD_WEBHOOK_URL"
buffer=""
fi
buffer+="$line\n"
done <<< "$message"
# Send any remaining content in the buffer
if [ -n "$buffer" ]; then
curl -X POST -H "Content-Type: application/json" \ curl -X POST -H "Content-Type: application/json" \
-d "$(jq -n --arg content "$chunk" '{content: $content}')" \ -d "$(jq -n --arg content "$buffer" '{content: $content}')" \
"$DISCORD_WEBHOOK_URL" "$DISCORD_WEBHOOK_URL"
message="${message:2000}" # Remove the sent chunk from the message fi
done
} }
send_discord_message "$MSG" send_discord_message "$MSG"