From d518708e969dbda11dcffb69c81816960c8f64c4 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 e74073c..0efab6a 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}"