From 1da6cf48d392c430a5ef852c82c90984df636ada Mon Sep 17 00:00:00 2001 From: celso Date: Wed, 22 Mar 2023 19:08:42 -0300 Subject: [PATCH] made getcbk_data implementation-agnostic and also it works now --- bashbot-lib.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bashbot-lib.sh b/bashbot-lib.sh index c6271e9..cd0c2c2 100755 --- a/bashbot-lib.sh +++ b/bashbot-lib.sh @@ -101,11 +101,10 @@ getchat_title(){ || getusr_name "${1}" } -get_cbks() { +getcbk_data() { local callbacks="$(tail -n 1 "${bot_tmpdir}${1}"\ - | grep "\"callback_query\"" | grep "\"callback_data\":\"recheck\"")" - [ ! -z "${callbacks}" ] && is_callback=0 && printf "%s\n" "${callbacks}"\ - >> "${bot_tmpdir}callbacks.txt" + | grep "\"callback_query\"" | grep -om1 '"data":"\(\\"\|[^"]*\)*"}')" + [ ! -z "${callbacks}" ] && utf-16-surrogate-pair-decode "${callbacks:8:-2}" } sendmsg() { @@ -146,4 +145,5 @@ getmsg_content(){ _REF[chat_title]="$(getchat_title "${2}")" _REF[msg_id]="$(getmsg_id "${2}")" _REF[text]="$(gettext "${2}")" + _REF[callback]="$(getcbk_data "${2}")" }