diff --git a/addons/antiFlood.sh b/addons/antiFlood.sh index 93e30f3..6b0439d 100644 --- a/addons/antiFlood.sh +++ b/addons/antiFlood.sh @@ -4,7 +4,7 @@ # this addon counts how many files, e.g. stickers, are sent to # a chat and takes actions if threshold is reached # -#### $$VERSION$$ v0.94-pre-3-g0e75138 +#### $$VERSION$$ v0.94-pre-4-gd28f975 # used events: # diff --git a/bashbot.sh b/bashbot.sh index b51dc04..2d03083 100755 --- a/bashbot.sh +++ b/bashbot.sh @@ -11,7 +11,7 @@ # This file is public domain in the USA and all free countries. # Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying) # -#### $$VERSION$$ v0.94-pre-3-g0e75138 +#### $$VERSION$$ v0.94-pre-4-gd28f975 # # Exit Codes: # - 0 sucess (hopefully) @@ -31,6 +31,23 @@ if [ -t 1 ] && [ -n "$TERM" ]; then NC='\e[0m' fi +# some important helper functions +# returns true if command exist +_exists() +{ + [ "$(LC_ALL=C type -t "$1")" = "file" ] +} + +# execute function if exists +_exec_if_function() { + [ "$(LC_ALL=C type -t "${1}")" != "function" ] || "$@" +} +# returns true if function exist +_is_function() +{ + [ "$(LC_ALL=C type -t "$1")" = "function" ] +} + # get location and name of bashbot.sh SCRIPT="$0" REALME="${BASH_SOURCE[0]}" @@ -79,7 +96,7 @@ DATADIR="${BASHBOT_VAR:-.}/data-bot-bash" COUNTFILE="${BASHBOT_VAR:-.}/count" # we assume everthing is already set up correctly if we have TOKEN -if [ -n "${BOTTOKEN}" ]; then +if [ -z "${BOTTOKEN}" ]; then # BOTTOKEN empty read from file if [ ! -f "${TOKENFILE}" ]; then if [ -z "${CLEAR}" ] && [ "$1" != "init" ]; then @@ -208,22 +225,6 @@ killallproc() { } -# returns true if command exist -_exists() -{ - [ "$(LC_ALL=C type -t "$1")" = "file" ] -} - -# execute function if exists -_exec_if_function() { - [ "$(LC_ALL=C type -t "${1}")" != "function" ] || "$@" -} -# returns true if function exist -_is_function() -{ - [ "$(LC_ALL=C type -t "$1")" = "function" ] -} - declare -xr DELETE_URL=$URL'/deleteMessage' delete_message() { sendJson "${1}" '"message_id": '"${2}"'' "${DELETE_URL}" diff --git a/commands.sh b/commands.sh index eb01970..9151065 100644 --- a/commands.sh +++ b/commands.sh @@ -15,7 +15,7 @@ # This file is public domain in the USA and all free countries. # Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying) # -#### $$VERSION$$ v0.94-pre-3-g0e75138 +#### $$VERSION$$ v0.94-pre-4-gd28f975 # # adjust your language setting here, e.g.when run from other user or cron. diff --git a/mycommands.sh b/mycommands.sh index 0e27afc..04bdb2e 100644 --- a/mycommands.sh +++ b/mycommands.sh @@ -8,7 +8,7 @@ # #### if you start to develop your own bot, use the clean version of this file: # #### mycommands.clean # -#### $$VERSION$$ v0.94-pre-3-g0e75138 +#### $$VERSION$$ v0.94-pre-4-gd28f975 # # uncomment the following lines to overwrite info and help messages diff --git a/mycommands.sh.clean b/mycommands.sh.clean index a824a3d..e525ef2 100644 --- a/mycommands.sh.clean +++ b/mycommands.sh.clean @@ -4,7 +4,7 @@ # files: mycommands.sh.clean # copy to mycommands.sh and add all your commands and functions here ... # -#### $$VERSION$$ v0.94-pre-3-g0e75138 +#### $$VERSION$$ v0.94-pre-4-gd28f975 # ########## diff --git a/test/ALL-tests.inc.sh b/test/ALL-tests.inc.sh index 04672b0..e275631 100644 --- a/test/ALL-tests.inc.sh +++ b/test/ALL-tests.inc.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -#### $$VERSION$$ v0.94-dev3-0-geef955a +#### $$VERSION$$ v0.94-pre-4-gd28f975 # common variables export TESTME DIRME TESTDIR LOGFILE REFDIR TESTNAME diff --git a/test/c-init-test.sh b/test/c-init-test.sh index 91cbe6c..dcd1f86 100755 --- a/test/c-init-test.sh +++ b/test/c-init-test.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -#### $$VERSION$$ v0.94-dev3-0-geef955a +#### $$VERSION$$ v0.94-pre-4-gd28f975 # include common functions and definitions # shellcheck source=test/ALL-tests.inc.sh