From f8935e75fc7c9cf113dd2b998907c33082bd0516 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 4a7b027..ac6c3a8 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() { @@ -145,4 +144,5 @@ getmsg_content(){ _REF[chat_title]="$(getchat_title "${2}")" _REF[msg_id]="$(getmsg_id "${2}")" _REF[text]="$(gettext "${2}")" + _REF[callback]="$(getcbk_data "${2}")" }