fix bashbot.sh source errors and update documentation

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2019-05-23 13:32:13 +02:00
parent 80a47780ce
commit e0bb9f85e1
7 changed files with 33 additions and 18 deletions

View File

@ -112,6 +112,6 @@
<p><span class="citation">@Gnadelwartz</span></p>
<h2 id="thats-it">Thats it!</h2>
<p>If you feel that theres something missing or if you found a bug, feel free to submit a pull request!</p>
<h4 id="version-v0.90-dev-2-g51aa2ed"><br /><span class="math display"><em>V</em><em>E</em><em>R</em><em>S</em><em>I</em><em>O</em><em>N</em></span><br /> v0.90-dev-2-g51aa2ed</h4>
<h4 id="version-v0.90-dev-3-g80a4778"><br /><span class="math display"><em>V</em><em>E</em><em>R</em><em>S</em><em>I</em><em>O</em><em>N</em></span><br /> v0.90-dev-3-g80a4778</h4>
</body>
</html>

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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