Compare commits

..
5 Commits
11 .. 16
Author SHA1 Message Date
nezumi 88a00ca413 update config 2025-01-22 19:41:27 +07:00
nezumi 788b36f083 update config 2025-01-22 19:24:00 +07:00
nezumi ae43197aa0 update config 2025-01-22 18:59:05 +07:00
nezumi c2fe93675e update config 2025-01-22 18:17:08 +07:00
nezumi aee01f1ca5 update config 2025-01-22 17:55:20 +07:00
+31 -3
View File
@@ -181,6 +181,34 @@ jobs:
${APKS}
"
curl -X POST -H "Content-Type: application/json" \
-d "$(jq -n --arg content "$MSG" '{content: $content}')" \
"$DISCORD_WEBHOOK_URL"
# Function to split messages properly by ensuring correct Markdown formatting
send_discord_message() {
local message="$1"
while [ ${#message} -gt 0 ]; do
# Attempt to find a safe split point within 2000 characters
local chunk="${message:0:2000}"
local cutoff=$(echo "$chunk" | awk '{print length($0) - length($NF)}') # Find last space/newline within chunk
if [ $cutoff -gt 0 ] && [ $cutoff -lt 2000 ]; then
# Use safe cutoff point if available
chunk="${message:0:$cutoff}"
message="${message:$cutoff}"
else
# Default to cutting at the 2000-character limit
chunk="${message:0:2000}"
message="${message:2000}"
fi
# Remove leading/trailing whitespace in the chunk and message
chunk=$(echo "$chunk" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
message=$(echo "$message" | sed 's/^[[:space:]]*//')
# Send the chunk to Discord
curl -X POST -H "Content-Type: application/json" \
-d "$(jq -n --arg content "$chunk" '{content: $content}')" \
"$DISCORD_WEBHOOK_URL"
done
}
send_discord_message "$MSG"