mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-11-25 00:37:34 +00:00
fix BOTTOKEN check
This commit is contained in:
parent
d28f9752d2
commit
6c6b312f47
@ -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:
|
||||
#
|
||||
|
37
bashbot.sh
37
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}"
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
#
|
||||
|
||||
##########
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user