Update 3_advanced.md

This commit is contained in:
Kay Marquardt 2023-04-17 13:54:01 +02:00 committed by GitHub
parent 0c25a11c5c
commit af7596f69a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 3 deletions

View File

@ -75,14 +75,19 @@ You must use the function `user_is_allowed` to check if a user has the capabilit
### Interactive Chats
Interactive chats are simple Bash scripts, reading user input as TEXT and output TEXT to the user.
**Important**: Scripts run as seperate programs in a [pipeline](https://www.geeksforgeeks.org/piping-in-unix-or-linux/), it's **not possible** to use bashbot functions and variables!
To create a new interactive chat script copy `scripts/interactive.sh.clean` to e.g. `scripts/mynewinteractive.sh`, make it executable
and then use `start_proc` function from your bot, it's possible to pass two arguments. You find more examples for interactive scripts in 'examples'
**Important**: Script run in a [pipeline](https://www.geeksforgeeks.org/piping-in-unix-or-linux/), it's **not possible** to use bashbot functions and variables!
```bash
mycommands.sh send user input as TEXT | script reads TEXT | bashbot.sh reads output as formated TEXT (see below)
```
To create a new interactive chat script copy `scripts/interactive.sh.clean` to e.g. `scripts/mynewinteractive.sh`, make it executable
and then use `start_proc` function from your bot, it's possible to pass two arguments. You find more examples for interactive scripts in 'examples'
In case you want to process any other data then message TEXT you must extraxt that information in `mycommnds.sh` and insert in message
before [sent to script]() (only recommended for bash experts):
#### Example script
*usage*: start_proc chat_id script arg1 arg2
@ -90,6 +95,7 @@ and then use `start_proc` function from your bot, it's possible to pass two argu
*usage*: check_prog chat_id
**Note:** Scripts must read user input from '$3' instead of stdin!
```bash