diff --git a/README.html b/README.html index 90dc011..fcbc942 100644 --- a/README.html +++ b/README.html @@ -112,6 +112,6 @@

@Gnadelwartz

That’s it!

If you feel that there’s something missing or if you found a bug, feel free to submit a pull request!

-


VERSION
v0.90-dev-2-g51aa2ed

+


VERSION
v0.90-dev-3-g80a4778

diff --git a/README.md b/README.md index 85c1304..dbfff7e 100644 --- a/README.md +++ b/README.md @@ -111,4 +111,4 @@ Hey no Problem, if you are finished with your cool bot run ```dev/make-standalon If you feel that there's something missing or if you found a bug, feel free to submit a pull request! -#### $$VERSION$$ v0.90-dev-2-g51aa2ed +#### $$VERSION$$ v0.90-dev-3-g80a4778 diff --git a/README.txt b/README.txt index 3190678..d86e9f2 100644 --- a/README.txt +++ b/README.txt @@ -160,4 +160,4 @@ down Version of your Bot](doc/7_develop.md) If you feel that there's something missing or if you found a bug, feel free to submit a pull request! -#### $$VERSION$$ v0.90-dev-2-g51aa2ed +#### $$VERSION$$ v0.90-dev-3-g80a4778 diff --git a/bashbot.sh b/bashbot.sh index 2746f56..4760cc7 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.90-dev-2-g51aa2ed +#### $$VERSION$$ v0.90-dev-3-g80a4778 # # Exit Codes: # - 0 sucess (hopefully) @@ -85,8 +85,8 @@ if [ ! -f "${BOTADMIN}" ]; then echo -e "${ORANGE}PLEASE WRITE YOUR TELEGRAM ID HERE OR ENTER '?'${NC}" echo -e "${ORANGE}TO MAKE FIRST USER TYPING '/start' TO BOTADMIN${NC}" read -r admin - printf '%S\n' "${admin}" > "${BOTADMIN}" - [ "${admin}" = "" ] && printf '%s\n' '?' > "${BOTADMIN}" + [ "${admin}" = "" ] && admin='?' + printf '%s\n' "${admin}" > "${BOTADMIN}" fi fi @@ -476,13 +476,9 @@ if [ ! -f "${JSONSHFILE}" ]; then fi ME="$(getBotName)" -if [ "$ME" = "" ]; then - if [ "$(< "${TOKENFILE}")" = "bashbottestscript" ]; then - ME="bashbottestscript" - else +if [ "$ME" = "" ] && [ "$1" != "source" ]; then echo -e "${RED}ERROR: Can't connect to Telegram Bot! May be your TOKEN is invalid ...${NC}" exit 1 - fi fi # source the script with source as param to use functions in other scripts diff --git a/doc/2_usage.md b/doc/2_usage.md index 3af8596..48de8f8 100644 --- a/doc/2_usage.md +++ b/doc/2_usage.md @@ -9,7 +9,7 @@ To stop the Bot run ```./bashbot.sh kill``` If some thing doesn't work as it should, you can debug with ```./bashbot.sh startbot DEBUG``` where DEBUG can be 'debug', 'xdebug' or 'xdebugx'. See [Bashbot Development](7_develop.md) for more information. -To use the functions provided in this script in other scripts simply source bashbot: ```source bashbot.sh``` +To use the functions provided in this script in other scripts simply source bashbot: ```source bashbot.sh source```. see [Expert Use](8_expert.md#Expert-use) Have FUN! @@ -182,5 +182,5 @@ send_action "${CHAT[ID]}" "action" #### [Prev Create Bot](1_firstbot.md) #### [Next Advanced Usage](3_advanced.md) -#### $$VERSION$$ v0.90-dev-0-g75691dc +#### $$VERSION$$ v0.90-dev-3-g80a4778 diff --git a/doc/7_develop.md b/doc/7_develop.md index a716302..957a79a 100644 --- a/doc/7_develop.md +++ b/doc/7_develop.md @@ -186,7 +186,7 @@ fi ``` #### [Prev Function Reference](6_reference.md) -#### [Next Bashbot Environment](8_custom.md) +#### [Next Expert Use](8_custom.md) -#### $$VERSION$$ v0.90-dev-0-g75691dc +#### $$VERSION$$ v0.90-dev-3-g80a4778 diff --git a/doc/8_custom.md b/doc/8_custom.md index 5ff6f81..9a5981e 100644 --- a/doc/8_custom.md +++ b/doc/8_custom.md @@ -8,8 +8,27 @@ You can use bashbot to send messages, locations, venues, pictures etc from comma For interactive use and script use should set and export BASHBOT_HOME to bashbots installation dir, e.g. '/usr/local/telegram-bot-bash'. see [Bashbot environemnt](#Bashbot-environment) -**Note:** If you don't set BASHBOT_HOME bashbot is expecting you are in the installation directory -of bashbot and will use relative pathnames to access ressources. +**Note:** If you don't set BASHBOT_HOME bashbot will use the actual directory as NEW home directory +which means it will create all needed files and ask for bot token and botadmin if you are not in the real bot home! + +*usage:* source bashbot.sh source + +*Examples:* +```bash +# if you are in the bashbot directory +source ./bashbot.sh source + +# use bashbot config in BASHBOT_HOME from any directory +export BASHBOT_HOME=/usr/local/telegram-bot-bash +source ${BASHBOT_HOME}/bashbot.sh source + +# use / create new config in current directory +unset BASHBOT_HOME +source /path/to/bashbot.sh source + +``` +**Warning:** If you forget the 'source' parameter for bashbot while sourcing you may geht error messages and +your current shell or script may terminate! #### Environment variable exported from bashbot If you have sourced 'bashbot.sh' you have the following bashot internal variables availible to @@ -228,5 +247,5 @@ for every poll until the maximum of BASHBOT_SLEEP ms. #### [Prev Notes for Developers](7_develop.md) -#### $$VERSION$$ v0.90-dev-2-g51aa2ed +#### $$VERSION$$ v0.90-dev-3-g80a4778