move JsonEscape up before sourcing other files

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2021-01-23 14:06:55 +01:00
parent 78e4551107
commit f995eeea13

View File

@ -30,7 +30,7 @@ BOTCOMMANDS="-h help init start stop status suspendback resumeback killb
# 8 - curl/wget missing
# 10 - not bash!
#
#### $$VERSION$$ v1.32-dev-11-g41e956d
#### $$VERSION$$ v1.32-dev-12-g78e4551
##################################################################
# emmbeded system may claim bash but it is not
@ -105,6 +105,12 @@ getConfigKey() {
[[ "$1" =~ ^[-${azAZo9},._]+$ ]] || return 3
[ -r "${BOTCONFIG}.jssh" ] && sed -n 's/\["'"$1"'"\]\t*"\(.*\)"/\1/p' "${BOTCONFIG}.jssh" | tail -n 1
}
# escape / remove text characters for json strings, eg. " -> \"
# $1 string
# output escaped string
JsonEscape(){
sed 's/\([-"`´,§$%&/(){}#@!?*.\t]\)/\\\1/g' <<< "$1"
}
# check if $1 seems a valid token
# return true if token seems to be valid
check_token(){
@ -618,13 +624,6 @@ sendJsonResult(){
fi
} >>"${ERRORLOG}"
# escape / remove text characters for json strings, eg. " -> \"
# $1 string
# output escaped string
JsonEscape(){
sed 's/\([-"`´,§$%&/(){}#@!?*.\t]\)/\\\1/g' <<< "$1"
}
# convert common telegram entities to JSON
# title caption description markup inlinekeyboard
title2Json(){