modules: process_update: ignore unknown update types

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2021-03-23 17:25:10 +01:00
parent 79fc511bdb
commit f790d73e66
2 changed files with 7 additions and 3 deletions

View File

@ -21,7 +21,7 @@ USAGE='process_update.sh [-h|--help] [-s|--startbot] [-w|--watch] [-n|--lines n]
# AUTHOR: KayM (gnadelwartz), kay@rrr.de # AUTHOR: KayM (gnadelwartz), kay@rrr.de
# CREATED: 27.02.2021 13:14 # CREATED: 27.02.2021 13:14
# #
#### $$VERSION$$ v1.51-dev-9-gcbd74a7 #### $$VERSION$$ v1.50-13-g79fc511
#=============================================================================== #===============================================================================
#### ####
@ -76,7 +76,7 @@ fi
# ready, do stuff here ----- # ready, do stuff here -----
# kill all sub processes on exit # kill all sub processes on exit
trap 'printf "%(%c)T: %s\n" -1 "Bot in '"${mode}"' mode stopped!"; kill $(jobs -p) 2>/dev/null; send_normal_message "'"${BOTADMIN}"'" "Bot '"${BOTNAME} ${mode}"' stopped ..."' EXIT HUP QUIT trap 'printf "%(%c)T: %s\n" -1 "Bot in '"${mode}"' mode stopped"; kill $(jobs -p) 2>/dev/null; send_normal_message "'"${BOTADMIN}"'" "Bot '"${BOTNAME} ${mode}"' stopped ..."' EXIT HUP QUIT
# wait after (first) update to avoid processing to many in parallel # wait after (first) update to avoid processing to many in parallel
UPDWAIT="0.5" UPDWAIT="0.5"

View File

@ -4,7 +4,7 @@
# File: processUpdates.sh # File: processUpdates.sh
# Note: DO NOT EDIT! this file will be overwritten on update # Note: DO NOT EDIT! this file will be overwritten on update
# #
#### $$VERSION$$ v1.51-dev-9-gcbd74a7 #### $$VERSION$$ v1.50-13-g79fc511
################################################################## ##################################################################
############## ##############
@ -91,6 +91,10 @@ process_update() {
printf "%(%c)T: update received FROM=%s CHAT=%s CMD=%s\n" -1 "${USER[USERNAME]:0:20} (${USER[ID]})"\ printf "%(%c)T: update received FROM=%s CHAT=%s CMD=%s\n" -1 "${USER[USERNAME]:0:20} (${USER[ID]})"\
"${CHAT[USERNAME]:0:20}${CHAT[TITLE]:0:30} (${CHAT[ID]})"\ "${CHAT[USERNAME]:0:20}${CHAT[TITLE]:0:30} (${CHAT[ID]})"\
"${MESSAGE:0:30}${CAPTION:0:30}${URLS[*]}" >>"${UPDATELOG}" "${MESSAGE:0:30}${CAPTION:0:30}${URLS[*]}" >>"${UPDATELOG}"
if [[ -z "${USER[ID]}" || -z "${CHAT[ID]}" ]]; then
printf "%(%c)T: IGNORE unknown update type: %s\n" -1 "$(grep '\["result",'"${num}"'.*,"id"\]' <<<"${UPDATE}")" >>"${UPDATELOG}"
return 1
fi
fi fi
##### #####
# process inline and message events # process inline and message events