diff --git a/modules/processUpdates.sh b/modules/processUpdates.sh index 8c9dc99..fbabf9d 100644 --- a/modules/processUpdates.sh +++ b/modules/processUpdates.sh @@ -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 diff --git a/mycommands.conf b/mycommands.conf index c74f079..5e3a6b6 100644 --- a/mycommands.conf +++ b/mycommands.conf @@ -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" diff --git a/mycommands.sh b/mycommands.sh index 8fe24e9..b9b6b8c 100644 --- a/mycommands.sh +++ b/mycommands.sh @@ -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 diff --git a/mycommands.sh.clean b/mycommands.sh.clean index a16f39c..17fa6f0 100644 --- a/mycommands.sh.clean +++ b/mycommands.sh.clean @@ -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