diff --git a/bin/bashbot_env.inc.sh b/bin/bashbot_env.inc.sh index 7b99ad4..f551153 100644 --- a/bin/bashbot_env.inc.sh +++ b/bin/bashbot_env.inc.sh @@ -1,16 +1,19 @@ #!/bin/bash #=============================================================================== # -# FILE: bashbor_env.inc.sh +# FILE: bashbot_env.inc.sh # +# USAGE: source bashbot_env.inc.sh [debug] +# # DESCRIPTION: set bashbot environment for all scripts in this directory # +# OPTIONS: $1 - will be forwarded ro bashbot, e.g. debug # # LICENSE: WTFPLv2 http://www.wtfpl.net/txt/copying/ # AUTHOR: KayM (gnadelwartz), kay@rrr.de # CREATED: 18.12.2020 12:27 # -#### $$VERSION$$ v1.2-dev2-38-g0db0215 +#### $$VERSION$$ v1.2-dev2-73-gf281ae0 #=============================================================================== # set where your bashbot lives @@ -31,3 +34,10 @@ if [ ! -r "${BASHBOT_HOME}/count.jssh" ]; then exit 3 fi +# source bashbot and check for ADMIN +# shellcheck disable=SC1090 +source "${BASHBOT_HOME}/bashbot.sh" source "$1" + +ADMIN="$(getConfigKey "botadmin")" +[ "${ADMIN}" = "?" ] && echo -e "${ORANGE}Warning: Botadmin not set, did you forget to sent command${NC} /start?" + diff --git a/bin/bashbot_stats.sh b/bin/bashbot_stats.sh index 9c749f3..80f5587 100755 --- a/bin/bashbot_stats.sh +++ b/bin/bashbot_stats.sh @@ -3,7 +3,7 @@ # # FILE: bin/bashbot_stats.sh # -# USAGE: bashbot_stats.sh [-h|--help] +# USAGE: bashbot_stats.sh [-h|--help] [debug] # # DESCRIPTION: output bashbot user stats # @@ -16,13 +16,9 @@ # AUTHOR: KayM (gnadelwartz), kay@rrr.de # CREATED: 23.12.2020 20:34 # -#### $$VERSION$$ v1.2-dev2-62-gfa24673 +#### $$VERSION$$ v1.2-dev2-73-gf281ae0 #=============================================================================== -# set bashbot environment -# shellcheck disable=SC1090 -source "${0%/*}/bashbot_env.inc.sh" - #### # parse args case "$1" in @@ -36,9 +32,9 @@ case "$1" in ;; esac -# source bashbot and send message +# set bashbot environment # shellcheck disable=SC1090 -source "${BASHBOT_HOME}/bashbot.sh" source "$1" +source "${0%/*}/bashbot_env.inc.sh" "$1" #### # ready, do stuff here ----- diff --git a/bin/send_broadcast.sh b/bin/send_broadcast.sh index 771cfc9..846dceb 100755 --- a/bin/send_broadcast.sh +++ b/bin/send_broadcast.sh @@ -24,13 +24,9 @@ # AUTHOR: KayM (gnadelwartz), kay@rrr.de # CREATED: 16.12.2020 16:14 # -#### $$VERSION$$ v1.2-dev2-67-g6173d77 +#### $$VERSION$$ v1.2-dev2-73-gf281ae0 #=============================================================================== -# set bashbot environment -# shellcheck disable=SC1090 -source "${0%/*}/bashbot_env.inc.sh" - #### # broadcast is dangerous, without --doit we do a dry run ... if [ "$1" = "--doit" ]; then @@ -79,9 +75,10 @@ case "$1" in ;; esac -# source bashbot +# set bashbot environment # shellcheck disable=SC1090 -source "${BASHBOT_HOME}/bashbot.sh" source "$3" +source "${0%/*}/bashbot_env.inc.sh" "$2" # $3 debug + # read in users declare -A SENDALL diff --git a/bin/send_edit_message.sh b/bin/send_edit_message.sh index 3354b77..9a47942 100755 --- a/bin/send_edit_message.sh +++ b/bin/send_edit_message.sh @@ -22,7 +22,7 @@ # AUTHOR: KayM (gnadelwartz), kay@rrr.de # CREATED: 23.12.2020 16:52 # -#### $$VERSION$$ v1.2-dev2-72-g269cbfb +#### $$VERSION$$ v1.2-dev2-73-gf281ae0 #=============================================================================== #### @@ -57,14 +57,7 @@ esac # set bashbot environment # shellcheck disable=SC1090 -source "${0%/*}/bashbot_env.inc.sh" - -# source bashbot and send message -# shellcheck disable=SC1090 -source "${BASHBOT_HOME}/bashbot.sh" source "$3" - -ADMIN="$(getConfigKey "botadmin")" -[ "${ADMIN}" = "?" ] && echo -e "${ORANGE}Warning: Botadmin not set, did you forget to sent command${NC} /start?" +source "${0%/*}/bashbot_env.inc.sh" "$4" # $4 debug #### #### diff --git a/bin/send_message.sh b/bin/send_message.sh index 8416e39..bbf6395 100755 --- a/bin/send_message.sh +++ b/bin/send_message.sh @@ -21,7 +21,7 @@ # AUTHOR: KayM (gnadelwartz), kay@rrr.de # CREATED: 16.12.2020 11:34 # -#### $$VERSION$$ v1.2-dev2-72-g269cbfb +#### $$VERSION$$ v1.2-dev2-73-gf281ae0 #=============================================================================== @@ -56,14 +56,7 @@ esac # set bashbot environment # shellcheck disable=SC1090 -source "${0%/*}/bashbot_env.inc.sh" - -# source bashbot and send message -# shellcheck disable=SC1090 -source "${BASHBOT_HOME}/bashbot.sh" source "$3" - -ADMIN="$(getConfigKey "botadmin")" -[ "${ADMIN}" = "?" ] && echo -e "${ORANGE}Warning: Botadmin not set, did you forget to sent command${NC} /start?" +source "${0%/*}/bashbot_env.inc.sh" "$3" # $3 debug #### # ready, do stuff here -----