From 25c9b62a766d8dc48ccf22c3bd54f654c13e50fe Mon Sep 17 00:00:00 2001 From: "Kay Marquardt (Gnadelwartz)" Date: Fri, 24 May 2019 20:30:01 +0200 Subject: [PATCH] FAQ: send message from CLI and scripts --- README.html | 15 ++++++++++++++- README.md | 22 +++++++++++++++++++++- README.txt | 25 ++++++++++++++++++++++++- 3 files changed, 59 insertions(+), 3 deletions(-) diff --git a/README.html b/README.html index cf3d7a2..9d2140a 100644 --- a/README.html +++ b/README.html @@ -169,6 +169,19 @@ It features background tasks and interactive chats, and can serve as an interfac

Can I have the single bashbot.sh file back?

At the beginning bashbot was simply the file bashbot.sh you can copy everywhere and run the bot. Now we have ‘commands.sh’, ‘mycommands.sh’, ’modules/*.sh’ and much more.

Hey no Problem, if you are finished with your cool bot run dev/make-standalone.sh to create a stripped down Version of your bot containing only ‘bashbot.sh’ and ‘commands.sh’! For more information see Create a stripped down Version of your Bot

+

Can I send messages from CLI and scripts?

+

Of course, you can send messages from CLI and scripts, simply install bashbot as described here, send the messsage ‘/start’ to set yourself as botadmin and stop the bot with ./bashbot.sh kill.

+

Run the following commands in your bash shell or script while you are in the installation directory:

+
# prepare bash / script to send commands
+export BASHBOT_HOME="$(pwd)"
+source ./bashbot.sh source
+
+# send me a test message
+send_message "$(cat "$BOTADMIN")" "test"
+
+# send me output of a system command
+send_message "$(<"$BOTADMIN")" "$(df -h)"
+

For more information see Expert Use

Why do I get “EXPECTED value GOT EOF” on start?

May be your IP is blocked by telegram. You can test this by running curl or wget manually:

curl -m 10  https://api.telegram.org/bot
@@ -180,6 +193,6 @@ It features background tasks and interactive chats, and can serve as an interfac
 

@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.80-18-g6b88656

+


VERSION
v0.80-22-g15e7f01

diff --git a/README.md b/README.md index fa01ced..2ffdd9c 100644 --- a/README.md +++ b/README.md @@ -144,6 +144,26 @@ At the beginning bashbot was simply the file ```bashbot.sh``` you can copy every Hey no Problem, if you are finished with your cool bot run ```dev/make-standalone.sh``` to create a stripped down Version of your bot containing only 'bashbot.sh' and 'commands.sh'! For more information see [Create a stripped down Version of your Bot](doc/7_develop.md) +### Can I send messages from CLI and scripts? +Of course, you can send messages from CLI and scripts, simply install bashbot as [described here](#Your-really-first-bashbot-in-a-nutshell), +send the messsage '/start' to set yourself as botadmin and stop the bot with ```./bashbot.sh kill```. + +Run the following commands in your bash shell or script while you are in the installation directory: + +```bash +# prepare bash / script to send commands +export BASHBOT_HOME="$(pwd)" +source ./bashbot.sh source + +# send me a test message +send_message "$(cat "$BOTADMIN")" "test" + +# send me output of a system command +send_message "$(<"$BOTADMIN")" "$(df -h)" +``` +For more information see [Expert Use](doc/8_custom.md) + + ### Why do I get "EXPECTED value GOT EOF" on start? May be your IP is blocked by telegram. You can test this by running curl or wget manually: ```bash @@ -162,4 +182,4 @@ This may happen if to many wrong requests are sent to api.telegram.org, e.g. usi If you feel that there's something missing or if you found a bug, feel free to submit a pull request! -#### $$VERSION$$ v0.80-18-g6b88656 +#### $$VERSION$$ v0.80-22-g15e7f01 diff --git a/README.txt b/README.txt index 371685d..014c974 100644 --- a/README.txt +++ b/README.txt @@ -208,6 +208,29 @@ containing only 'bashbot.sh' and 'commands.sh'! For more information see [Create a stripped down Version of your Bot](doc/7_develop.md) +### Can I send messages from CLI and scripts? +Of course, you can send messages from CLI and scripts, simply install bashbot +as [described here](#Your-really-first-bashbot-in-a-nutshell), +send the messsage '/start' to set yourself as botadmin and stop the bot with +```./bashbot.sh kill```. + +Run the following commands in your bash shell or script while you are in the +installation directory: + +```bash +# prepare bash / script to send commands +export BASHBOT_HOME="$(pwd)" +source ./bashbot.sh source + +# send me a test message +send_message "$(cat "$BOTADMIN")" "test" + +# send me output of a system command +send_message "$(<"$BOTADMIN")" "$(df -h)" +``` +For more information see [Expert Use](doc/8_custom.md) + + ### Why do I get "EXPECTED value GOT EOF" on start? May be your IP is blocked by telegram. You can test this by running curl or wget manually: @@ -233,4 +256,4 @@ tor proxy on your server you may uncomment the ```BASHBOT_CURL_ARGS``` line in If you feel that there's something missing or if you found a bug, feel free to submit a pull request! -#### $$VERSION$$ v0.80-18-g6b88656 +#### $$VERSION$$ v0.80-22-g15e7f01