mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2025-02-11 14:38:33 +00:00
test: fix init test
This commit is contained in:
parent
eee5458232
commit
2f6f3bd4d8
45
bashbot.sh
45
bashbot.sh
@ -30,7 +30,7 @@ BOTCOMMANDS="-h help init start stop status suspendback resumeback killb
|
|||||||
# 8 - curl/wget missing
|
# 8 - curl/wget missing
|
||||||
# 10 - not bash!
|
# 10 - not bash!
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ v1.45-dev-3-g429c230
|
#### $$VERSION$$ v1.45-dev-5-geee5458
|
||||||
##################################################################
|
##################################################################
|
||||||
|
|
||||||
# are we running in a terminal?
|
# are we running in a terminal?
|
||||||
@ -276,29 +276,26 @@ if [ -z "${BOTTOKEN}" ]; then
|
|||||||
printf '["botadmin"]\t"%s"\n' "${admin}" >> "${BOTCONFIG}.jssh"
|
printf '["botadmin"]\t"%s"\n' "${admin}" >> "${BOTCONFIG}.jssh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# skip on init
|
# setup botacl file
|
||||||
if [ "$1" != "init" ]; then
|
if [ ! -f "${BOTACL}" ]; then
|
||||||
# setup botacl file
|
printf "${GREY}Create initial ${BOTACL} file.${NN}"
|
||||||
if [ ! -f "${BOTACL}" ]; then
|
printf '\n' >"${BOTACL}"
|
||||||
printf "${GREY}Create initial ${BOTACL} file.${NN}"
|
fi
|
||||||
printf '\n' >"${BOTACL}"
|
# check data dir file
|
||||||
fi
|
if [ ! -w "${DATADIR}" ]; then
|
||||||
# check data dir file
|
printf "${RED}ERROR: ${DATADIR} does not exist or is not writeable!.${NN}"
|
||||||
if [ ! -w "${DATADIR}" ]; then
|
[ "$1" != "init" ] && exit_source 2 # skip on init
|
||||||
printf "${RED}ERROR: ${DATADIR} does not exist or is not writeable!.${NN}"
|
fi
|
||||||
exit_source 2
|
# setup count file
|
||||||
fi
|
if [ ! -f "${COUNTFILE}.jssh" ]; then
|
||||||
# setup count file
|
printf '["counted_user_chat_id"]\t"num_messages_seen"\n' >> "${COUNTFILE}.jssh"
|
||||||
if [ ! -f "${COUNTFILE}.jssh" ]; then
|
elif [ ! -w "${COUNTFILE}.jssh" ]; then
|
||||||
printf '["counted_user_chat_id"]\t"num_messages_seen"\n' >> "${COUNTFILE}.jssh"
|
printf "${RED}WARNING: Can't write to ${COUNTFILE}!.${NN}"
|
||||||
elif [ ! -w "${COUNTFILE}.jssh" ]; then
|
ls -l "${COUNTFILE}.jssh"
|
||||||
printf "${RED}WARNING: Can't write to ${COUNTFILE}!.${NN}"
|
fi
|
||||||
ls -l "${COUNTFILE}.jssh"
|
# setup blocked file
|
||||||
fi
|
if [ ! -f "${BLOCKEDFILE}.jssh" ]; then
|
||||||
# setup blocked file
|
printf '["blocked_user_or_chat_id"]\t"name and reason"\n' >>"${BLOCKEDFILE}.jssh"
|
||||||
if [ ! -f "${BLOCKEDFILE}.jssh" ]; then
|
|
||||||
printf '["blocked_user_or_chat_id"]\t"name and reason"\n' >>"${BLOCKEDFILE}.jssh"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user