mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-11-26 17:26:27 +00:00
global BASHBOTDEBUG, do not log getting updates
This commit is contained in:
parent
d221fb698e
commit
eea1de6cbd
@ -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.98-dev-40-g344167e
|
#### $$VERSION$$ v0.98-dev-41-gd221fb6
|
||||||
#
|
#
|
||||||
# Exit Codes:
|
# Exit Codes:
|
||||||
# - 0 sucess (hopefully)
|
# - 0 sucess (hopefully)
|
||||||
@ -319,7 +319,7 @@ if [ -z "${BASHBOT_WGET}" ] && _exists curl ; then
|
|||||||
[ -z "${BASHBOT_CURL}" ] && BASHBOT_CURL="curl"
|
[ -z "${BASHBOT_CURL}" ] && BASHBOT_CURL="curl"
|
||||||
# simple curl or wget call, output to stdout
|
# simple curl or wget call, output to stdout
|
||||||
getJson(){
|
getJson(){
|
||||||
[ -n "${BASHBOTDEBUG}" ] && printf "%s: getJson (curl) URL=%s\n" "$(date)" "${1##*/}"
|
[[ -n "${BASHBOTDEBUG}" && -z "${3}" ]] && printf "%s: getJson (curl) URL=%s\n" "$(date)" "${1##*/}"
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
"${BASHBOT_CURL}" -sL -k ${BASHBOT_CURL_ARGS} -m "${TIMEOUT}" "$1"
|
"${BASHBOT_CURL}" -sL -k ${BASHBOT_CURL_ARGS} -m "${TIMEOUT}" "$1"
|
||||||
}
|
}
|
||||||
@ -352,7 +352,7 @@ if [ -z "${BASHBOT_WGET}" ] && _exists curl ; then
|
|||||||
else
|
else
|
||||||
# simple curl or wget call outputs result to stdout
|
# simple curl or wget call outputs result to stdout
|
||||||
getJson(){
|
getJson(){
|
||||||
[ -n "${BASHBOTDEBUG}" ] && printf "%s: getJson (wget) URL=%s\n" "$(date)" "${1##*/}"
|
[[ -n "${BASHBOTDEBUG}" && -z "${3}" ]] && printf "%s: getJson (wget) URL=%s\n" "$(date)" "${1##*/}"
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
wget --no-check-certificate -t 2 -T "${TIMEOUT}" ${BASHBOT_WGET_ARGS} -qO - "$1"
|
wget --no-check-certificate -t 2 -T "${TIMEOUT}" ${BASHBOT_WGET_ARGS} -qO - "$1"
|
||||||
}
|
}
|
||||||
@ -867,7 +867,7 @@ start_bot() {
|
|||||||
# adaptive sleep in ms rounded to next 0.1 s
|
# adaptive sleep in ms rounded to next 0.1 s
|
||||||
sleep "$(_round_float "${nextsleep}e-3" "1")"
|
sleep "$(_round_float "${nextsleep}e-3" "1")"
|
||||||
# get next update
|
# get next update
|
||||||
UPDATE="$(getJson "$UPD_URL$OFFSET" 2>/dev/null | "${JSONSHFILE}" -s -b -n 2>/dev/null | iconv -f utf-8 -t utf-8 -c)"
|
UPDATE="$(getJson "$UPD_URL$OFFSET" "nolog" 2>/dev/null | "${JSONSHFILE}" -s -b -n 2>/dev/null | iconv -f utf-8 -t utf-8 -c)"
|
||||||
# did we ge an responsn0r
|
# did we ge an responsn0r
|
||||||
if [ -n "${UPDATE}" ]; then
|
if [ -n "${UPDATE}" ]; then
|
||||||
# we got something, do processing
|
# we got something, do processing
|
||||||
|
Loading…
Reference in New Issue
Block a user