bin: basshot_env: improve messages

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2021-02-01 10:18:42 +01:00
parent c4d100e0ad
commit 91a143ab15
3 changed files with 9 additions and 8 deletions

View File

@ -30,7 +30,7 @@ BOTCOMMANDS="-h help init start stop status suspendback resumeback killb
# 8 - curl/wget missing
# 10 - not bash!
#
#### $$VERSION$$ v1.40-dev-26-ge86c8dc
#### $$VERSION$$ v1.40-dev-27-gc4d100e
##################################################################
# are we running in a terminal?

View File

@ -21,7 +21,7 @@ USAGE='any_command.sh [-h|--help] [--force|--reference] bot_command args ...'
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
# CREATED: 30.01.2021 10:24
#
#### $$VERSION$$ v1.40-dev-17-g8034a5f
#### $$VERSION$$ v1.40-dev-27-gc4d100e
#===============================================================================
####

View File

@ -13,7 +13,7 @@
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
# CREATED: 18.12.2020 12:27
#
#### $$VERSION$$ v1.32-dev-6-g2832801
#### $$VERSION$$ v1.40-dev-27-gc4d100e
#===============================================================================
############
@ -32,20 +32,21 @@ BASHBOT_ETC="${BASHBOT_HOME}"
#####
# if files are not readable, eviroment is wrong or bashbot is not initialized
# source bashbot
# check for bashbot
if [ ! -r "${BASHBOT_HOME}/bashbot.sh" ]; then
printf "%s\n" "Bashbot.sh not found in \"${BASHBOT_HOME}\""
exit 4
fi
dev=" Are we in dev or did you forget to run init?"
# check for botconfig.jssh readable
if [ ! -r "${BASHBOT_ETC}/botconfig.jssh" ]; then
printf "%s\n" "Bashbot config file in \"${BASHBOT_ETC}\" does not exist or is not readable."
printf "%s\n" "Bashbot config file in \"${BASHBOT_ETC}\" does not exist or is not readable. ${dev}"
exit 3
fi
# check for count.jssh readable
if [ ! -r "${BASHBOT_VAR}/count.jssh" ]; then
printf "%s\n" "Bashbot count file in \"${BASHBOT_VAR}\" does not exist or is not readable. Did you run bashbot init?"
printf "%s\n" "Bashbot count file in \"${BASHBOT_VAR}\" does not exist or is not readable. ${dev}"
exit 3
fi
@ -60,8 +61,8 @@ FILE_REGEX="${UPLOADDIR}/.*"
# get and check ADMIN and NAME
BOT_ADMIN="$(getConfigKey "botadmin")"
BOT_NAME="$(getConfigKey "botname")"
[[ -z "${BOT_ADMIN}" || "${BOT_ADMIN}" == "?" ]] && printf "%s\n" "${ORANGE}Warning: Botadmin not set, did you forget to sent command${NC} /start"
[[ -z "${BOT_NAME}" ]] && printf "%s\n" "${ORANGE}Warning: Botname not set, did you ever run bashbot?"
[[ -z "${BOT_ADMIN}" || "${BOT_ADMIN}" == "?" ]] && printf "%s\n" "${ORANGE}Warning: Botadmin not set, send bot command${NC} /start"
[[ -z "${BOT_NAME}" ]] && printf "%s\n" "${ORANGE}Warning: Botname not set, run bashbot.sh botname"
# output command result or Telegram response
print_result() { jssh_printDB "BOTSENT" | sort -r; }