mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-11-21 15:15:09 +00:00
modules: processUpdates: optimize inform user if blocked
This commit is contained in:
parent
f7f55ea45f
commit
e4c13ddabe
@ -4,7 +4,7 @@
|
||||
# File: processUpdates.sh
|
||||
# Note: DO NOT EDIT! this file will be overwritten on update
|
||||
#
|
||||
#### $$VERSION$$ v1.51-dev-18-g9b6aba0
|
||||
#### $$VERSION$$ v1.51-dev-19-gf7f55ea
|
||||
##################################################################
|
||||
|
||||
##############
|
||||
@ -62,7 +62,7 @@ process_multi_updates() {
|
||||
# processing of a single array item of update
|
||||
# $1 array index
|
||||
process_update() {
|
||||
local num="$1" debug="$2"
|
||||
local chatuser="User" num="$1" debug="$2"
|
||||
pre_process_message "${num}"
|
||||
# log message on debug
|
||||
[[ -n "${debug}" ]] && log_message "New Message ==========\n$(grep -F '["result",'"${num}" <<<"${UPDATE}")"
|
||||
@ -70,11 +70,9 @@ process_update() {
|
||||
# check for users / groups to ignore, inform them ...
|
||||
jssh_updateArray_async "BASHBOTBLOCKED" "${BLOCKEDFILE}"
|
||||
if [ -n "${USER[ID]}" ] && [[ -n "${BASHBOTBLOCKED[${USER[ID]}]}" || -n "${BASHBOTBLOCKED[${CHAT[ID]}]}" ]];then
|
||||
if [ -n "${BASHBOTBLOCKED[${USER[ID]}]}" ]; then
|
||||
send_normal_message "${USER[ID]}" "User blocked because: ${BASHBOTBLOCKED[${USER[ID]}]}" &
|
||||
else
|
||||
send_normal_message "${CHAT[ID]}" "Chat blocked because: ${BASHBOTBLOCKED[${CHAT[ID]}]}" &
|
||||
fi
|
||||
[ -n "${BASHBOTBLOCKED[${USER[ID]}]}" ] && chatuser="User"
|
||||
[ "${NOTIFY_BLOCKED_USERS}" == "yes" ] &&\
|
||||
send_normal_message "${CHAT[ID]}" "${chatuser} blocked because: ${BASHBOTBLOCKED[${USER[ID]}]} ${BASHBOTBLOCKED[${CHAT[ID]}]}" &
|
||||
return
|
||||
fi
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
# Author: KayM (gnadelwartz), kay@rrr.de
|
||||
# Created: 09.01.2021 07:27
|
||||
#
|
||||
#### $$VERSION$$ v1.5-0-g8adca9b
|
||||
#### $$VERSION$$ v1.51-dev-19-gf7f55ea
|
||||
#######################################################
|
||||
|
||||
##########
|
||||
@ -96,6 +96,9 @@ WELCOME_MSG="Welcome"
|
||||
# export REPORT_NEWMEMBER="yes"
|
||||
# export REPORT_LEFTMEMBER="yes"
|
||||
|
||||
# uncomment to send user blocked by bot a warning if they send commands
|
||||
# export NOTIFY_BLOCKED_USERS="yes"
|
||||
|
||||
# messages for admin only commands
|
||||
NOTADMIN="Sorry, this command is allowed for admin or owner only"
|
||||
NOTBOTADMIN="Sorry, this command is allowed for bot owner only"
|
||||
|
@ -13,7 +13,7 @@
|
||||
# License: WTFPLv2 http://www.wtfpl.net/txt/copying/
|
||||
# Author: KayM (gnadelwartz), kay@rrr.de
|
||||
#
|
||||
#### $$VERSION$$ v1.51-dev-18-g9b6aba0
|
||||
#### $$VERSION$$ v1.51-dev-19-gf7f55ea
|
||||
#######################################################
|
||||
# shellcheck disable=SC1117
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
# License: WTFPLv2 http://www.wtfpl.net/txt/copying/
|
||||
# Author: KayM (gnadelwartz), kay@rrr.de
|
||||
#
|
||||
#### $$VERSION$$ v1.51-dev-18-g9b6aba0
|
||||
#### $$VERSION$$ v1.51-dev-19-gf7f55ea
|
||||
#######################################################
|
||||
# shellcheck disable=SC1117
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user