diff --git a/README.html b/README.html index 6e3c304..e1ae4dd 100644 --- a/README.html +++ b/README.html @@ -241,10 +241,10 @@ It features background tasks and interactive chats, and can serve as an interfac source ./bashbot.sh source # send me a test message -send_message "$(cat "$BOTADMIN")" "test" +send_message "$(getConfigKey "botadmin")" "test" # send me output of a system command -send_message "$(<"$BOTADMIN")" "$(df -h)" +send_message "$(getConfigKey "botadmin")" "$(df -h)"

For more information see Expert Use

Blocked by telegram?

This may happen if to many wrong requests are sent to api.telegram.org, e.g. using a wrong token or not existing API calls. If you have a fixed IP you can ask telegram service to unblock your ip or change your IP. If you are running a tor proxy on your server you may uncomment the BASHBOT_CURL_ARGS line in 'mycommands.sh'

@@ -254,9 +254,19 @@ It features background tasks and interactive chats, and can serve as an interfac wget -t 1 -T 10 https://api.telegram.org/bot #Connecting to api.telegram.org (api.telegram.org)|46.38.243.234|:443... failed: Connection timed out. +

Since Version 0.98 bashbot can recover from broken connection to Telegram (aka blocked). therefore you must provide the function bashbotBlockRecover() in mycommands.sh. There you can check e.g. if your connection is working, change IP or simply wait some time.

+

If everything seems OK return 0 for retry or any non 0 value for abort.

+
# called when bashbot sedn command failed because we can not connect to telegram
+# return 0 to retry, return non 0 to give up
+bashbotBlockRecover() {
+    # place your commands to unblock here, e.g. change IP or simply wait
+    sleep 60 && return 0 # may be temporary
+    return 1 
+    }
+

@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.98-0-g5b5447e

+

$$VERSION$$ v0.99-dev2-1-gef4d21f

diff --git a/README.md b/README.md index 5a0cd3b..622bb1a 100644 --- a/README.md +++ b/README.md @@ -213,10 +213,10 @@ export BASHBOT_HOME="$(pwd)" source ./bashbot.sh source # send me a test message -send_message "$(cat "$BOTADMIN")" "test" +send_message "$(getConfigKey "botadmin")" "test" # send me output of a system command -send_message "$(<"$BOTADMIN")" "$(df -h)" +send_message "$(getConfigKey "botadmin")" "$(df -h)" ``` For more information see [Expert Use](doc/8_custom.md) @@ -233,10 +233,27 @@ wget -t 1 -T 10 https://api.telegram.org/bot #Connecting to api.telegram.org (api.telegram.org)|46.38.243.234|:443... failed: Connection timed out. ``` +Since Version 0.98 bashbot can recover from broken connection to Telegram (aka blocked). therefore you must provide the function +`bashbotBlockRecover()` in `mycommands.sh`. There you can check e.g. if your connection is working, change IP or simply wait some time. + +If everything seems OK return 0 for retry or any non 0 value for abort. + +```bash +# called when bashbot sedn command failed because we can not connect to telegram +# return 0 to retry, return non 0 to give up +bashbotBlockRecover() { + # place your commands to unblock here, e.g. change IP or simply wait + sleep 60 && return 0 # may be temporary + return 1 + } + +``` + + @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.98-0-g5b5447e +#### $$VERSION$$ v0.99-dev2-1-gef4d21f diff --git a/README.txt b/README.txt index d80c3da..5d58bfd 100644 --- a/README.txt +++ b/README.txt @@ -295,10 +295,10 @@ export BASHBOT_HOME="$(pwd)" source ./bashbot.sh source # send me a test message -send_message "$(cat "$BOTADMIN")" "test" +send_message "$(getConfigKey "botadmin")" "test" # send me output of a system command -send_message "$(<"$BOTADMIN")" "$(df -h)" +send_message "$(getConfigKey "botadmin")" "$(df -h)" ``` For more information see [Expert Use](doc/8_custom.md) @@ -320,6 +320,25 @@ wget -t 1 -T 10 https://api.telegram.org/bot failed: Connection timed out. ``` +Since Version 0.98 bashbot can recover from broken connection to Telegram (aka +blocked). therefore you must provide the function +`bashbotBlockRecover()` in `mycommands.sh`. There you can check e.g. if your +connection is working, change IP or simply wait some time. + +If everything seems OK return 0 for retry or any non 0 value for abort. + +```bash +# called when bashbot sedn command failed because we can not connect to telegram +# return 0 to retry, return non 0 to give up +bashbotBlockRecover() { + # place your commands to unblock here, e.g. change IP or simply wait + sleep 60 && return 0 # may be temporary + return 1 + } + +``` + + @Gnadelwartz ## That's it! @@ -327,4 +346,4 @@ failed: Connection timed out. If you feel that there's something missing or if you found a bug, feel free to submit a pull request! -#### $$VERSION$$ v0.98-0-g5b5447e +#### $$VERSION$$ v0.99-dev2-1-gef4d21f diff --git a/mycommands.sh b/mycommands.sh index 3696782..3084104 100644 --- a/mycommands.sh +++ b/mycommands.sh @@ -8,7 +8,7 @@ # #### if you start to develop your own bot, use the clean version of this file: # #### mycommands.clean # -#### $$VERSION$$ v0.99-dev2-0-g2b10471 +#### $$VERSION$$ v0.99-dev2-1-gef4d21f # # uncomment the following lines to overwrite info and help messages @@ -251,7 +251,7 @@ else # called when bashbot sedn command failed because we can not connect to telegram # return 0 to retry, return non 0 to give up bashbotBlockRecover() { - # place your commnds to unblock here, e.g. change IP or simply wait + # place your commands to unblock here, e.g. change IP or simply wait sleep 60 && return 0 # may be temporary return 1 }