diff --git a/bin/process_batch.sh b/bin/process_batch.sh index 5fa0e1e..dd40d28 100755 --- a/bin/process_batch.sh +++ b/bin/process_batch.sh @@ -20,7 +20,7 @@ USAGE='process_update.sh [-h|--help] -w|--watch [-n|--lines n] [file] [debug]' # AUTHOR: KayM (gnadelwartz), kay@rrr.de # CREATED: 27.02.2021 13:14 # -#### $$VERSION$$ v1.45-dev-52-g84ff8ce +#### $$VERSION$$ v1.45-dev-53-g941598d #=============================================================================== #### @@ -62,9 +62,11 @@ tail ${follow} ${lines} "${file}" |\ while IFS="" read -r input do # read json from stdin and convert update format - json='{"result": ['"${input}"']}' + # replace any ID named BOTADMIN with ID of bot admin + : "${input//\"id\":BOTADMIN,/\"id\":${BOT_ADMIN},}" + json='{"result": ['"${_}"']}' UPDATE="$(${JSONSHFILE} -b -n <<<"${json}" 2>/dev/null)" # process telegram update - "${COMMAND}" "$1" + "${COMMAND}" "$2" done diff --git a/bin/process_update.sh b/bin/process_update.sh index ec36da8..439679d 100755 --- a/bin/process_update.sh +++ b/bin/process_update.sh @@ -15,7 +15,7 @@ USAGE='process_update.sh [-h|--help] [debug] [/dev/null)" # process telegram update diff --git a/bin/promote_user.sh b/bin/promote_user.sh index fdcaad0..a0faa63 100755 --- a/bin/promote_user.sh +++ b/bin/promote_user.sh @@ -25,7 +25,7 @@ USAGE='promote_user.sh [-h|--help] "CHAT[ID]" "USER[ID]" "right[:true|false]" .. # AUTHOR: KayM (gnadelwartz), kay@rrr.de # CREATED: 25.01.2021 22:34 # -#### $$VERSION$$ v1.40-0-gf9dab50 +#### $$VERSION$$ v1.45-dev-53-g941598d #=============================================================================== #### diff --git a/examples/webhook/json.txt b/examples/webhook/json.txt index 6cf3c52..4defd69 100644 --- a/examples/webhook/json.txt +++ b/examples/webhook/json.txt @@ -1 +1 @@ -{"update_id":665220889,"message":{"message_id":760,"from":{"id":586928566,"is_bot":false,"first_name":"Kay","last_name":"M","username":"KayM","language_code":"de"},"chat":{"id":589682731,"first_name":"Kay","last_name":"M","username":"KayM","type":"private"},"date":1612029749,"text":"/info","entities":[{"offset":0,"length":5,"type":"bot_command"}]}} +{"update_id":665220889,"message":{"message_id":760,"from":{"id":BOTADMIN,"is_bot":false,"first_name":"Kay","last_name":"M","username":"KayM","language_code":"de"},"chat":{"id":BOTADMIN,"first_name":"Kay","last_name":"M","username":"KayM","type":"private"},"date":1612029749,"text":"/info","entities":[{"offset":0,"length":5,"type":"bot_command"}]}}