From 3fb7796c99b44f48c72e322b1b835c895e556016 Mon Sep 17 00:00:00 2001 From: "Kay Marquardt (Gnadelwartz)" Date: Fri, 19 Apr 2019 11:28:12 +0200 Subject: [PATCH] adjust bashbot and doc to changed dirs --- README.md | 11 +++++------ bashbot.sh | 2 +- doc/1_firstbot.md | 2 +- doc/2_usage.md | 2 +- doc/3_advanced.md | 8 ++++---- doc/4_expert.md | 6 +++--- doc/5_practice.md | 6 +++--- doc/6_reference.md | 14 +++++++------- 8 files changed, 25 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 556bd4c..867706c 100644 --- a/README.md +++ b/README.md @@ -20,11 +20,10 @@ Bashbot [Documentation](https://github.com/topkecleon/telegram-bot-bash) and [Do 1. Go to the directory you want to install bashbot, e.g. * your $HOME directory (install and run with your user-ID) * /usr/local if you want to run as service -2. Clone the repository: - ``` - git clone --recursive https://github.com/topkecleon/telegram-bot-bash - ``` -3. Change to directory ```telegram-bot-bash```, run ```./bashbot.sh init``` and follow the instructions. At this stage you are asked for your Bots token given by botfather. +2. [Download latest release archive from github](https://github.com/topkecleon/telegram-bot-bash/releases) and unpack it. + + If you want the current version from github, clone the repository: ```git clone https://github.com/topkecleon/telegram-bot-bash``` +3. Change directory to ```telegram-bot-bash``` and run ```./bashbot.sh init```. Now follow the instructions. At one point you are asked for your Bots token given by botfather. ## Update bashbot 1. [Download latest update zip from github](https://github.com/topkecleon/telegram-bot-bash/releases) @@ -99,4 +98,4 @@ Bashbot is not more (in)secure as any other Bot written in any other language, w If you feel that there's something missing or if you found a bug, feel free to submit a pull request! -#### $$VERSION$$ 0.70-dev-4-g12fd839 +#### $$VERSION$$ 0.70-dev-5-ga97cd69 diff --git a/bashbot.sh b/bashbot.sh index 6b9dd00..ff9e44a 100755 --- a/bashbot.sh +++ b/bashbot.sh @@ -10,7 +10,7 @@ # This file is public domain in the USA and all free countries. # Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying) # -#### $$VERSION$$ 0.70-dev-4-g12fd839 +#### $$VERSION$$ 0.70-dev-5-ga97cd69 # # Exit Codes: # - 0 sucess (hopefully) diff --git a/doc/1_firstbot.md b/doc/1_firstbot.md index 186015d..daec160 100644 --- a/doc/1_firstbot.md +++ b/doc/1_firstbot.md @@ -61,5 +61,5 @@ group. This step is up to you actually. #### [Next Getting started](2_usage.md) -#### $$VERSION$$ 0.70-dev-4-g12fd839 +#### $$VERSION$$ 0.70-dev-5-ga97cd69 diff --git a/doc/2_usage.md b/doc/2_usage.md index 98e9d97..a7e7064 100644 --- a/doc/2_usage.md +++ b/doc/2_usage.md @@ -159,5 +159,5 @@ send_action "${CHAT[ID]}" "action" #### [Prev Create Bot](1_firstbot.md) #### [Next Advanced Usage](3_advanced.md) -#### $$VERSION$$ 0.70-dev-4-g12fd839 +#### $$VERSION$$ 0.70-dev-5-ga97cd69 diff --git a/doc/3_advanced.md b/doc/3_advanced.md index 0fe9391..cef13ae 100644 --- a/doc/3_advanced.md +++ b/doc/3_advanced.md @@ -58,7 +58,7 @@ you have to use the function ```user_is_allowed``` to check if a user has the ca ``` ### Interactive Chats -To create interactive chats, write (or edit the question script) a normal bash (or C or python) script, chmod +x it and then change the argument of the startproc function to match the command you usually use to start the script. +To create interactive chats, write (or edit the exmaples/question.sh script) a normal bash (or C or python) script, chmod +x it and then change the argument of the startproc function to match the command you usually use to start the script. The text that the script will output will be sent in real time to the user, and all user input will be sent to the script (as long as it's running or until the user kills it with /cancel). To open up a keyboard in an interactive script, print out the keyboard layout in the following way: ```bash @@ -90,9 +90,9 @@ Note: Interactive Chats run independent from main bot and continue running until ### Background Jobs -A background job is similar to an interactive chat, but runs in the background and does only output massages instead of processing input from the user. In contrast to interactive chats it's possible to run multiple background jobs. To create a background job write a script or edit the notify script and use the funtion ```background``` to start it: +A background job is similar to an interactive chat, but runs in the background and does only output massages instead of processing input from the user. In contrast to interactive chats it's possible to run multiple background jobs. To create a background job write a script or edit the examples/notify.sh script and use the funtion ```background``` to start it: ```bash -background "./notify" "jobname" +background "examples/notify.sh" "jobname" ``` All output of the script will be sent to the user or chat. To stop a background job use: ```bash @@ -156,5 +156,5 @@ answer_inline_query "$iQUERY_ID" "cached_sticker" "identifier for the sticker" #### [Prev Advanced Usage](3_advanced.md) #### [Next Expert Use](4_expert.md) -#### $$VERSION$$ 0.70-dev-4-g12fd839 +#### $$VERSION$$ 0.70-dev-5-ga97cd69 diff --git a/doc/4_expert.md b/doc/4_expert.md index 1c44d09..62f1dc8 100644 --- a/doc/4_expert.md +++ b/doc/4_expert.md @@ -96,13 +96,13 @@ To change back the environment to your user-ID run ```sudo ./bashbot.sh init``` To use bashbot as a system servive include a working ```bashbot.rc``` in your init system (systemd, /etc/init.d). ### Scedule bashbot from Cron -An example crontab is provided in ```bashbot.cron```. +An example crontab is provided in ```examples/bashbot.cron```. - If you are running bashbot with your user-ID, copy the examples lines to your crontab and remove username ```nobody```. -- if you run bashbot as an other user or a system service edit ```bashbot.cron``` to fit your needs and replace username```nobody``` with the username you want to run bashbot. copy the modified file to ```/etc/cron.d/bashbot``` +- if you run bashbot as an other user or a system service edit ```examples/bashbot.cron``` to fit your needs and replace username```nobody``` with the username you want to run bashbot. copy the modified file to ```/etc/cron.d/bashbot``` #### [Prev Expert Use](4_expert.md) #### [Next Best Practice](5_practice.md) -#### $$VERSION$$ 0.70-dev-4-g12fd839 +#### $$VERSION$$ 0.70-dev-5-ga97cd69 diff --git a/doc/5_practice.md b/doc/5_practice.md index 36b9965..ea839e0 100644 --- a/doc/5_practice.md +++ b/doc/5_practice.md @@ -89,9 +89,9 @@ Line 17: ``` As you can see my ```mybotcommands.inc.sh``` contains an useless echo command in 'TEXT=' assigment and can be replaced by ```TEXT="${TEXT}${WORD}"``` ```bash -$ shellcheck -x notify +$ shellcheck -x examples/notify OK -$ shellcheck -x question +$ shellcheck -x examples/question OK $ shellcheck -x commands.sh OK @@ -112,5 +112,5 @@ The second warning is about an unused variable, this is true because in our exam #### [Prev Best Practice](5_practice.md) #### [Next Functions Reference](6_reference.md) -#### $$VERSION$$ 0.70-dev-4-g12fd839 +#### $$VERSION$$ 0.70-dev-5-ga97cd69 diff --git a/doc/6_reference.md b/doc/6_reference.md index cefc443..05c0d1c 100644 --- a/doc/6_reference.md +++ b/doc/6_reference.md @@ -216,11 +216,11 @@ fi ##### startproc ```startproc``` starts a script (or C or python program etc.) running in parallel to your Bot. The text that the script outputs is sent to the user or chat, user input will be sent back to the script. see [Advanced Usage](3_advanced.md#Interactive-Chats) -*usage:* startproc "./script" +*usage:* startproc "script" *example:* ```bash -startproc './calc' +startproc 'examples/calc.sh' ``` ##### checkproc @@ -232,7 +232,7 @@ Return true (0) if an interactive script active in the given chat. ```bash checkproc if [ "$res" -gt 0 ] ; then - startproc "./calc" + startproc "examples/calc.sh" else send_normal_message "${CHAT[ID]}" "Calc already running ..." fi @@ -258,11 +258,11 @@ fi In contrast to interactive chats, background jobs do not recieve user input and can run forever. In addition you can suspend and restart running jobs, e.g. after reboot. -*usage:* background "./script" "jobname" +*usage:* background "script" "jobname" *example:* ```bash -background "./notify" "notify" +background "examples/notify.sh" "notify" ``` ##### checkback @@ -275,7 +275,7 @@ Return true (0) if an background job is active in the given chat. checkback "notify" if [ "$res" -gt 0 ] ; then send_normal_message "${CHAT[ID]}" "Start notify" - background "./notify" "notify" + background "examples/notify.sh" "notify" else send_normal_message "${CHAT[ID]}" "Process notify already running." fi @@ -347,5 +347,5 @@ Send Input from Telegram to waiting Interactive Chat. #### [Prev Best Practice](5_practice.md) -#### $$VERSION$$ 0.70-dev-4-g12fd839 +#### $$VERSION$$ 0.70-dev-5-ga97cd69