From afbdb1e7a56107dfa776b7ba9c45233c64deedd6 Mon Sep 17 00:00:00 2001 From: "Kay Marquardt (Gnadelwartz)" Date: Sun, 2 Aug 2020 10:03:35 +0200 Subject: [PATCH] fix formatted message longer 4095 --- modules/sendMessage.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/sendMessage.sh b/modules/sendMessage.sh index 7c204dc..9f59bce 100644 --- a/modules/sendMessage.sh +++ b/modules/sendMessage.sh @@ -5,7 +5,7 @@ # This file is public domain in the USA and all free countries. # Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying) # -#### $$VERSION$$ 0.99-4-g15eb311 +#### $$VERSION$$ 0.99-6-gc4ab7ff # will be automatically sourced from bashbot @@ -46,7 +46,7 @@ send_normal_message() { send_markdown_message() { local text; text="$(JsonEscape "${2}")" - [ "${#text}" -le 4096 ] && log_error "Warning: markdown message longer than 4096 characters, message is rejected if formatting crosses 4096 border." + [ "${#text}" -ge 4096 ] && log_error "Warning: markdown message longer than 4096 characters, message is rejected if formatting crosses 4096 border." until [ -z "${text}" ]; do sendJson "${1}" '"text":"'"${text:0:4096}"'","parse_mode":"markdown"' "${MSG_URL}" text="${text:4096}" @@ -55,7 +55,7 @@ send_markdown_message() { send_markdownv2_message() { local text; text="$(JsonEscape "${2}")" - [ "${#text}" -le 4096 ] && log_error "Warning: markdown message longer than 4096 characters, message is rejected if formatting crosses 4096 border." + [ "${#text}" -ge 4096 ] && log_error "Warning: markdown message longer than 4096 characters, message is rejected if formatting crosses 4096 border." # markdown v2 needs additional double escaping! text="$(sed -E -e 's|([#{}()!.-])|\\\1|g' <<< "$text")" until [ -z "${text}" ]; do @@ -66,7 +66,7 @@ send_markdownv2_message() { send_html_message() { local text; text="$(JsonEscape "${2}")" - [ "${#text}" -le 4096 ] && log_error "Warning: html message longer than 4096 characters, message is rejected if formatting crosses 4096 border." + [ "${#text}" -ge 4096 ] && log_error "Warning: html message longer than 4096 characters, message is rejected if formatting crosses 4096 border." until [ -z "${text}" ]; do sendJson "${1}" '"text":"'"${text:0:4096}"'","parse_mode":"html"' "${MSG_URL}" text="${text:4096}"