mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2025-04-11 16:41:49 +00:00
make some globals readonly
This commit is contained in:
parent
cb3f3e32f3
commit
afc669c915
13
bashbot.sh
13
bashbot.sh
@ -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.90-dev2-12-gf2f5e11
|
#### $$VERSION$$ v0.90-dev2-13-gcb3f3e3
|
||||||
#
|
#
|
||||||
# Exit Codes:
|
# Exit Codes:
|
||||||
# - 0 sucess (hopefully)
|
# - 0 sucess (hopefully)
|
||||||
@ -32,10 +32,8 @@ if [ -t 1 ] && [ "$TERM" != "" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# get location and name of bashbot.sh
|
# get location and name of bashbot.sh
|
||||||
export SCRIPT SCRIPTDIR MODULEDIR RUNDIR RUNUSER
|
|
||||||
SCRIPT="$0"
|
SCRIPT="$0"
|
||||||
REALME="${BASH_SOURCE[0]}"
|
REALME="${BASH_SOURCE[0]}"
|
||||||
|
|
||||||
SCRIPTDIR="$(dirname "${REALME}")"
|
SCRIPTDIR="$(dirname "${REALME}")"
|
||||||
RUNDIR="$(dirname "$0")"
|
RUNDIR="$(dirname "$0")"
|
||||||
|
|
||||||
@ -56,7 +54,6 @@ fi
|
|||||||
|
|
||||||
ADDONDIR="${BASHBOT_ETC:-./addons}"
|
ADDONDIR="${BASHBOT_ETC:-./addons}"
|
||||||
|
|
||||||
|
|
||||||
RUNUSER="${USER}" # USER is overwritten by bashbot array
|
RUNUSER="${USER}" # USER is overwritten by bashbot array
|
||||||
|
|
||||||
if [ "${SOURCE}" != "yes" ] && [ "$BASHBOT_HOME" = "" ] && ! cd "${RUNDIR}" ; then
|
if [ "${SOURCE}" != "yes" ] && [ "$BASHBOT_HOME" = "" ] && ! cd "${RUNDIR}" ; then
|
||||||
@ -132,7 +129,9 @@ ME_URL=$URL'/getMe'
|
|||||||
UPD_URL=$URL'/getUpdates?offset='
|
UPD_URL=$URL'/getUpdates?offset='
|
||||||
GETFILE_URL=$URL'/getFile'
|
GETFILE_URL=$URL'/getFile'
|
||||||
|
|
||||||
unset USER
|
declare -rx SCRIPT SCRIPTDIR MODULEDIR RUNDIR ADDONDIR TOKENFILE BOTADMIN BOTACL DATADIR COUNTFILE
|
||||||
|
declare -rx BOTTOKEN URL ME_URL UPD_URL GETFILE_URL
|
||||||
|
|
||||||
declare -ax CMD
|
declare -ax CMD
|
||||||
declare -Ax UPD BOTSENT USER MESSAGE URLS CONTACT LOCATION CHAT FORWARD REPLYTO VENUE iQUERY
|
declare -Ax UPD BOTSENT USER MESSAGE URLS CONTACT LOCATION CHAT FORWARD REPLYTO VENUE iQUERY
|
||||||
export res CAPTION
|
export res CAPTION
|
||||||
@ -210,7 +209,7 @@ _is_function()
|
|||||||
[ "$(LC_ALL=C type -t "$1")" = "function" ]
|
[ "$(LC_ALL=C type -t "$1")" = "function" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
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}"
|
||||||
}
|
}
|
||||||
@ -323,7 +322,7 @@ Json2Array() {
|
|||||||
# output ARRAY as JSON.sh style data
|
# output ARRAY as JSON.sh style data
|
||||||
# $1 ARRAY name, must be declared with "declare -A ARRAY" before calling
|
# $1 ARRAY name, must be declared with "declare -A ARRAY" before calling
|
||||||
Array2Json() {
|
Array2Json() {
|
||||||
local ARRAY, key
|
local key
|
||||||
declare -n ARRAY="$1"
|
declare -n ARRAY="$1"
|
||||||
for key in "${!ARRAY[@]}"
|
for key in "${!ARRAY[@]}"
|
||||||
do
|
do
|
||||||
|
@ -5,7 +5,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.90-dev2-0-gec85636
|
#### $$VERSION$$ v0.90-dev2-13-gcb3f3e3
|
||||||
|
|
||||||
# source from commands.sh to use the inline functions
|
# source from commands.sh to use the inline functions
|
||||||
|
|
||||||
|
@ -5,7 +5,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.90-dev2-0-gec85636
|
#### $$VERSION$$ v0.90-dev2-13-gcb3f3e3
|
||||||
|
|
||||||
# source from commands.sh to use the member functions
|
# source from commands.sh to use the member functions
|
||||||
|
|
||||||
|
@ -5,7 +5,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.90-dev2-11-g59aa9fc
|
#### $$VERSION$$ v0.90-dev2-13-gcb3f3e3
|
||||||
|
|
||||||
# source from commands.sh to use the sendMessage functions
|
# source from commands.sh to use the sendMessage functions
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user