fix BOTTOKEN check

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2020-05-14 21:31:52 +02:00
parent d28f9752d2
commit 6c6b312f47
7 changed files with 25 additions and 24 deletions

View File

@ -4,7 +4,7 @@
# this addon counts how many files, e.g. stickers, are sent to # this addon counts how many files, e.g. stickers, are sent to
# a chat and takes actions if threshold is reached # a chat and takes actions if threshold is reached
# #
#### $$VERSION$$ v0.94-pre-3-g0e75138 #### $$VERSION$$ v0.94-pre-4-gd28f975
# used events: # used events:
# #

View File

@ -11,7 +11,7 @@
# This file is public domain in the USA and all free countries. # This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying) # Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
# #
#### $$VERSION$$ v0.94-pre-3-g0e75138 #### $$VERSION$$ v0.94-pre-4-gd28f975
# #
# Exit Codes: # Exit Codes:
# - 0 sucess (hopefully) # - 0 sucess (hopefully)
@ -31,6 +31,23 @@ if [ -t 1 ] && [ -n "$TERM" ]; then
NC='\e[0m' NC='\e[0m'
fi 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 # get location and name of bashbot.sh
SCRIPT="$0" SCRIPT="$0"
REALME="${BASH_SOURCE[0]}" REALME="${BASH_SOURCE[0]}"
@ -79,7 +96,7 @@ DATADIR="${BASHBOT_VAR:-.}/data-bot-bash"
COUNTFILE="${BASHBOT_VAR:-.}/count" COUNTFILE="${BASHBOT_VAR:-.}/count"
# we assume everthing is already set up correctly if we have TOKEN # 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 # BOTTOKEN empty read from file
if [ ! -f "${TOKENFILE}" ]; then if [ ! -f "${TOKENFILE}" ]; then
if [ -z "${CLEAR}" ] && [ "$1" != "init" ]; 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' declare -xr DELETE_URL=$URL'/deleteMessage'
delete_message() { delete_message() {
sendJson "${1}" '"message_id": '"${2}"'' "${DELETE_URL}" sendJson "${1}" '"message_id": '"${2}"'' "${DELETE_URL}"

View File

@ -15,7 +15,7 @@
# This file is public domain in the USA and all free countries. # This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying) # 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. # adjust your language setting here, e.g.when run from other user or cron.

View File

@ -8,7 +8,7 @@
# #### if you start to develop your own bot, use the clean version of this file: # #### if you start to develop your own bot, use the clean version of this file:
# #### mycommands.clean # #### mycommands.clean
# #
#### $$VERSION$$ v0.94-pre-3-g0e75138 #### $$VERSION$$ v0.94-pre-4-gd28f975
# #
# uncomment the following lines to overwrite info and help messages # uncomment the following lines to overwrite info and help messages

View File

@ -4,7 +4,7 @@
# files: mycommands.sh.clean # files: mycommands.sh.clean
# copy to mycommands.sh and add all your commands and functions here ... # copy to mycommands.sh and add all your commands and functions here ...
# #
#### $$VERSION$$ v0.94-pre-3-g0e75138 #### $$VERSION$$ v0.94-pre-4-gd28f975
# #
########## ##########

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#### $$VERSION$$ v0.94-dev3-0-geef955a #### $$VERSION$$ v0.94-pre-4-gd28f975
# common variables # common variables
export TESTME DIRME TESTDIR LOGFILE REFDIR TESTNAME export TESTME DIRME TESTDIR LOGFILE REFDIR TESTNAME

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#### $$VERSION$$ v0.94-dev3-0-geef955a #### $$VERSION$$ v0.94-pre-4-gd28f975
# include common functions and definitions # include common functions and definitions
# shellcheck source=test/ALL-tests.inc.sh # shellcheck source=test/ALL-tests.inc.sh