From 4d0ef5998b58c2a7415dbfce1a3320e79b825d8c Mon Sep 17 00:00:00 2001 From: celso Date: Wed, 22 Mar 2023 08:14:48 -0300 Subject: [PATCH] fixed wrong text being selected --- bashbot-lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bashbot-lib.sh b/bashbot-lib.sh index 37d2aad..63a9ddb 100755 --- a/bashbot-lib.sh +++ b/bashbot-lib.sh @@ -69,7 +69,7 @@ utf-16-surrogate-pair-decode() { gettext() { local text="$(tail -n 1 "${bot_tmpdir}${1}" | grep -om1\ - '\("text"\|"caption"\):"\(\\"\|[^"]*\)*"\(,\|}\)' | tail -n1)" + '{\?\("text"\|"caption"\):"\(\\"\|[^"]*\)*"\(,\|}\)' | grep -v "^{" | tail -n1)" grep "^\"text\"" <<< "${text}" >/dev/null && utf-16-surrogate-pair-decode "${text:8:-2}"\ || { grep "^\"caption\"" <<< "${text}" >/dev/null && utf-16-surrogate-pair-decode "${text:11:-2}"