mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2025-01-16 02:42:19 +00:00
allow block chats also, optimize blockfile reading
This commit is contained in:
parent
cc69310a7e
commit
bc44331183
12
bashbot.sh
12
bashbot.sh
@ -11,7 +11,7 @@
|
|||||||
# This file is public domain in the USA and all free countries.
|
# This file is public domain in the USA and all free countries.
|
||||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ v0.98-dev-11-g6563891
|
#### $$VERSION$$ v0.98-dev-14-gcc69310
|
||||||
#
|
#
|
||||||
# Exit Codes:
|
# Exit Codes:
|
||||||
# - 0 sucess (hopefully)
|
# - 0 sucess (hopefully)
|
||||||
@ -515,8 +515,8 @@ process_client() {
|
|||||||
[[ -n "${debug}" ]] && printf "\n%s: New Message ==========\n%s\n" "$(date)" "$UPDATE" >>"${LOGDIR}/MESSAGE.log"
|
[[ -n "${debug}" ]] && printf "\n%s: New Message ==========\n%s\n" "$(date)" "$UPDATE" >>"${LOGDIR}/MESSAGE.log"
|
||||||
|
|
||||||
# check for uers / groups to ignore
|
# check for uers / groups to ignore
|
||||||
[ -n "${USER[ID]}" ] && [[ " ${!BASHBOT_BLOCKED[*]} " == *" ${USER[ID]} "* ]] && return
|
[[ -n "$(jssh_getKeyDB_async "${USER[ID]}" "${BLOCKEDFILE}")" ||
|
||||||
jssh_readDB_async "BASHBOT_BLOCKED" "${BLOCKEDFILE}"
|
-n "$(jssh_getKeyDB_async "${CHAT[ID]}" "${BLOCKEDFILE}")" ]] && return
|
||||||
|
|
||||||
# process per message type
|
# process per message type
|
||||||
if [ -z "${iQUERY[ID]}" ]; then
|
if [ -z "${iQUERY[ID]}" ]; then
|
||||||
@ -802,7 +802,7 @@ start_bot() {
|
|||||||
local stepsleep="${BASHBOT_SLEEP_STEP:-100}"
|
local stepsleep="${BASHBOT_SLEEP_STEP:-100}"
|
||||||
local maxsleep="${BASHBOT_SLEEP:-5000}"
|
local maxsleep="${BASHBOT_SLEEP:-5000}"
|
||||||
# startup message
|
# startup message
|
||||||
DEBUG="$(date):Start BASHBOT updates in Mode \"${1:-normal}\" =========="
|
DEBUG="$(date): Start BASHBOT updates in Mode \"${1:-normal}\" =========="
|
||||||
printf "%s\n" "${DEBUG}" >>"${UPDATELOG}"
|
printf "%s\n" "${DEBUG}" >>"${UPDATELOG}"
|
||||||
# redirect to Debug.log
|
# redirect to Debug.log
|
||||||
[[ "${1}" == *"debug" ]] && exec &>>"${DEBUGLOG}"
|
[[ "${1}" == *"debug" ]] && exec &>>"${DEBUGLOG}"
|
||||||
@ -1018,7 +1018,7 @@ if [ "${SOURCE}" != "yes" ]; then
|
|||||||
echo -e "${GREEN}Bot is running with UID ${RUNUSER}.${NC}"
|
echo -e "${GREEN}Bot is running with UID ${RUNUSER}.${NC}"
|
||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
echo -e "${ORANGE}Bot not running with UID ${RUNUSER}.${NC}"
|
echo -e "${ORANGE}No Bot running with UID ${RUNUSER}.${NC}"
|
||||||
exit 5
|
exit 5
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
@ -1049,7 +1049,7 @@ if [ "${SOURCE}" != "yes" ]; then
|
|||||||
exit 5
|
exit 5
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo -e "${ORANGE}Bot not running with UID ${RUNUSER}.${NC}"
|
echo -e "${ORANGE}No Bot running with UID ${RUNUSER}.${NC}"
|
||||||
fi
|
fi
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
|
Loading…
Reference in New Issue
Block a user