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}"