fixed last_name edge case in replies from a user without one to another with

This commit is contained in:
celso 2025-03-12 19:50:31 -03:00
parent 2faa8b1b4b
commit 5cc36fe5bc
1 changed files with 3 additions and 2 deletions

View File

@ -87,10 +87,11 @@ getfirst_name(){
|| {
grep "\"language_code\"$" <<< "${first_name}" >/dev/null && utf-16-surrogate-pair-decode "${first_name:14:-17}"
} || {
grep "\"last_name\"$" <<< "${first_name}" >/dev/null && utf-16-surrogate-pair-decode "${first_name:14:-13}"
grep "\"last_name\"$" <<< "${first_name}" >/dev/null && utf-16-surrogate-pair-decode "${first_name:14:-13}" && return 0
} || {
grep "},\"chat\"$" <<< "${first_name}" >/dev/null && utf-16-surrogate-pair-decode "${first_name:14:-9}"
}
return 1
}
getlast_name(){
@ -105,7 +106,7 @@ getlast_name(){
}
getusr_name(){
local user_name="$(getfirst_name ${1}) $(getlast_name ${1})"
local user_name="$({ getfirst_name ${1} && getlast_name ${1}; } | sed ":a;N;$!ba;s/\n/ /")"
[ "${user_name}" != "" ] && printf "%s" "${user_name}"
}