mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-11-22 15:35:09 +00:00
data-bot-bash is created while installing
This commit is contained in:
parent
23e04a98ef
commit
74dfdd753f
15
bashbot.sh
15
bashbot.sh
@ -26,7 +26,7 @@
|
||||
# 8 - curl/wget missing
|
||||
# 10 - not bash!
|
||||
#
|
||||
#### $$VERSION$$ v1.21-pre-5-gc296899
|
||||
#### $$VERSION$$ v1.21-pre-6-g23e04a9
|
||||
##################################################################
|
||||
# shellcheck disable=SC2140,SC2031,SC2120,SC1091,SC1117,SC2059
|
||||
|
||||
@ -199,9 +199,10 @@ LOGDIR="${RUNDIR:-.}/logs"
|
||||
|
||||
# CREATE botconfig if not exist
|
||||
# assume everything already set up correctly if TOKEN is set
|
||||
if [[ -z "${BOTTOKEN}" && ! -f "${BOTCONFIG}.jssh" ]]; then
|
||||
if [ -z "${BOTTOKEN}" ]; then
|
||||
# BOTCONFIG does not exist, create
|
||||
printf '["bot_config_key"]\t"config_key_value"\n' >>"${BOTCONFIG}.jssh"
|
||||
[ ! -f "${BOTCONFIG}.jssh" ] && printf '["bot_config_key"]\t"config_key_value"\n' >>"${BOTCONFIG}.jssh"
|
||||
if [ -z "$(getConfigKey "bottoken")" ]; then
|
||||
# ask user for bot token
|
||||
if [ -z "${INTERACTIVE}" ] && [ "$1" != "init" ]; then
|
||||
printf "Running headless, set BOTTOKEN or run ${SCRIPT} init first!\n"
|
||||
@ -213,7 +214,7 @@ if [[ -z "${BOTTOKEN}" && ! -f "${BOTCONFIG}.jssh" ]]; then
|
||||
printf "\n"
|
||||
fi
|
||||
[ -n "${token}" ] && printf '["bottoken"]\t"%s"\n' "${token}" >> "${BOTCONFIG}.jssh"
|
||||
|
||||
fi
|
||||
# no botadmin, setup botadmin
|
||||
if [ -z "$(getConfigKey "botadmin")" ]; then
|
||||
# ask user for bot admin
|
||||
@ -232,10 +233,8 @@ if [[ -z "${BOTTOKEN}" && ! -f "${BOTCONFIG}.jssh" ]]; then
|
||||
printf "${GREY}Create initial ${BOTACL} file.${NN}"
|
||||
printf '\n' >"${BOTACL}"
|
||||
fi
|
||||
# setup data dir file
|
||||
if [ ! -d "${DATADIR}" ]; then
|
||||
mkdir "${DATADIR}"
|
||||
elif [ ! -w "${DATADIR}" ]; then
|
||||
# check data dir file
|
||||
if [ ! -w "${DATADIR}" ]; then
|
||||
printf "${RED}ERROR: Can't write to ${DATADIR}!.${NN}"
|
||||
ls -ld "${DATADIR}"
|
||||
exit 2
|
||||
|
Loading…
Reference in New Issue
Block a user