added getreplymsg_id getreplyusrname and getreplyusr_name
This commit is contained in:
parent
19615186da
commit
e643e39a03
|
@ -117,12 +117,34 @@ gettimestamp() {
|
|||
[ ! -z "${timestamp}" ] && date "+%D %H:%M" -d "@${timestamp:7:-1}"
|
||||
}
|
||||
|
||||
getreplytext() {
|
||||
grep reply_to_message "${bot_tmpdir}${1}" && local replytext="$(tail -n 1 "${bot_tmpdir}${1}" | grep -om1\
|
||||
'{\?\("text"\|"caption"\):"\(\\"\|[^"]*\)*"\(,\|}\)' | grep -v "^{" | head -n1)"
|
||||
grep "^\"text\"" <<< "${text}" >/dev/null && utf-16-surrogate-pair-decode "${replytext:8:-2}"\
|
||||
getreplymsg_id(){
|
||||
local replymsg_id="$(tail -n 1 "${bot_tmpdir}${1}"\
|
||||
| grep -om1 "\"reply_to_message\":{\"message_id\":[0-9]\+" | grep -o "[0-9]\+")"
|
||||
[ ! -z "${replymsg_id}" ] && utf-16-surrogate-pair-decode "${replymsg_id}"
|
||||
}
|
||||
|
||||
getreplyusr_name(){
|
||||
local user_name="$(tail -n 1 "${bot_tmpdir}${1}"\
|
||||
| grep -om1 '"first_name":"\(\\"\|[^"]*\)*","username"' | tail -n2 | head -n1)"
|
||||
grep "\"username\"$" <<< "${user_name}" >/dev/null\
|
||||
&& utf-16-surrogate-pair-decode "${user_name:14:-12}"
|
||||
}
|
||||
|
||||
getreplyusrname(){
|
||||
local username="$(tail -n 1 "${bot_tmpdir}${1}" | grep -om1\
|
||||
'"username":"\(\\"\|[^"]*\)*"\(,"language_code"\|},"chat"\)' | tail -n1)"
|
||||
grep "\"language_code\"$" <<< "${username}" >/dev/null && utf-16-surrogate-pair-decode "${username:12:-17}"\
|
||||
|| {
|
||||
grep "^\"caption\"" <<< "${text}" >/dev/null && utf-16-surrogate-pair-decode "${replytext:11:-2}"
|
||||
grep "},\"chat\"$" <<< "${username}" >/dev/null && utf-16-surrogate-pair-decode "${username:12:-9}"
|
||||
}
|
||||
}
|
||||
|
||||
getreplytext() {
|
||||
grep "reply_to_message" "${bot_tmpdir}${1}" >/dev/null && local replytext="$(tail -n 1 "${bot_tmpdir}${1}" | grep -om1\
|
||||
'{\?\("text"\|"caption"\):"\(\\"\|[^"]*\)*"\(,\|}\)' | grep -v "^{" | head -n1)"
|
||||
grep "^\"text\"" <<< "${replytext}" >/dev/null && utf-16-surrogate-pair-decode "${replytext:8:-2}"\
|
||||
|| {
|
||||
grep "^\"caption\"" <<< "${replytext}" >/dev/null && utf-16-surrogate-pair-decode "${replytext:11:-2}"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -229,5 +251,9 @@ getmsg_content(){
|
|||
_REF[text]="$(gettext "${2}")"
|
||||
_REF[callback]="$(getcbk_data "${2}")"
|
||||
_REF[timestamp]="$(gettimestamp "${2}")"
|
||||
local replytext="$(getreplytext "${2}")"; [ ! -z "${replytext}" ] && _REF[replytext]="$(getreplytext "${2}")"
|
||||
_REF[replytext]="$(getreplytext "${2}")"
|
||||
_REF[replymsg_id]="$(getreplymsg_id "${2}")"
|
||||
_REF[replyusername]="$(getreplyusrname "${2}")"
|
||||
_REF[replyuser_name]="$(getreplyusr_name "${2}")"
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue