mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2025-01-29 16:48:24 +00:00
v1.20 doc/ update
This commit is contained in:
parent
74ab0c24fc
commit
cd5cbfd5ef
@ -106,7 +106,7 @@ echo -e "Your Message: ${test}\nbye!"
|
||||
#### message formatting and keyboards
|
||||
|
||||
The output of the script will be processed by 'send_messages', so you can not only send text, but also keyboards, files, locations and more.
|
||||
Each newline in the output will start an new message to the userr. To have line breaks in your message you must insert ' mynewlinestartshere ' or '\n' instead.
|
||||
Each newline in the output will start an new message to the user. To have line breaks in your message you must insert ' mynewlinestartshere ' or '\n' instead.
|
||||
|
||||
To open up a keyboard in an interactive script, print out the keyboard layout in the following way:
|
||||
```bash
|
||||
@ -114,8 +114,11 @@ echo "Text that will appear in chat? mykeyboardstartshere [ \"Yep, sure\" , \"No
|
||||
```
|
||||
Same goes for files:
|
||||
```bash
|
||||
echo "Text that will appear in chat? myfilelocationstartshere /home/user/doge.jpg"
|
||||
echo "Text that will appear in chat? myfilelocationstartshere /home/user/dog.jpg"
|
||||
```
|
||||
*Note*: Use an _absolute path name_ (starting with `/`), a relative path name is relative to `data-bot-bash/upload`!
|
||||
See [send_file documentation](6_reference.md#send_file) for more information.
|
||||
|
||||
And buttons:
|
||||
```bash
|
||||
echo "Text that will appear in chat. mybtextstartshere Click me myburlstartshere https://dealz.rrr.de"
|
||||
@ -299,5 +302,5 @@ Note: If you disable automatic retry, se above, you disable also connection prob
|
||||
#### [Prev Getting started](2_usage.md)
|
||||
#### [Next Expert Use](4_expert.md)
|
||||
|
||||
#### $$VERSION$$ v1.20-0-g2ab00a2
|
||||
#### $$VERSION$$ v1.21-dev-2-gde31231
|
||||
|
||||
|
@ -114,20 +114,30 @@ The main use case for send_message is to process the output of interactive chats
|
||||
|
||||
|
||||
##### send_file
|
||||
send_file allows you to send different type's of files, e.g. photos, stickers, audio, media, etc. [see more](https://core.telegram.org/bots/api#sending-files)
|
||||
send_file allows can send different type's of files, e.g. photos, stickers, audio, media, etc.
|
||||
[see Telegram API documentation](https://core.telegram.org/bots/api#sending-files).
|
||||
|
||||
- file names must not contain ".."
|
||||
- file names must not start with "."
|
||||
- file names not starting with "/" are relative to $TMPDIR, e.g. ./data-bot-bash
|
||||
- absolute filenames must match $FILE_REGEX
|
||||
- FILE_REGEX is a regular expression, not shell globbing, test you rexexes: http://www.softlion.com/webTools/RegExpTest/
|
||||
It's recommended to use __absolute path names__ (_starting with `/`_), as relative path names are threated as __relative to UPLOADDIR__ `data-bot-bash/upload`!
|
||||
|
||||
For security reasons the following restrictions apply:
|
||||
|
||||
- absolute path name must match the __shell regex__ `FILE_REGEX` (_not file glob_)
|
||||
- path must not start with `./` and not contain `../`
|
||||
|
||||
*usage:* send_file "${CHAT[ID]}" "file" "caption"
|
||||
|
||||
*example:*
|
||||
```bash
|
||||
send_file "${CHAT[ID]}" "/home/user/doge.jpg" "Lool"
|
||||
send_file "${CHAT[ID]}" "https://www.domain,com/something.gif" "Something"
|
||||
# recommended: absolute path
|
||||
send_file "${CHAT[ID]}" "/home/user/dog.jpg" "My Dog"
|
||||
|
||||
# relative to UPLOADDIR: data-bot-bash/upload/dog.jpg
|
||||
send_file "${CHAT[ID]}" "dog.jpg" "My Dog"
|
||||
|
||||
# change to personal upload dir
|
||||
UPLOADDIR="/home/user/myuploaddir"
|
||||
# relative to personal upload dir: /home/user/myuploaddir/dog.jpg
|
||||
send_file "${CHAT[ID]}" "dog.jpg" "My Dog"
|
||||
```
|
||||
|
||||
##### send_album
|
||||
@ -1145,5 +1155,5 @@ The name of your bot is available as bash variable "$ME", there is no need to ca
|
||||
#### [Prev Best Practice](5_practice.md)
|
||||
#### [Next Notes for Developers](7_develop.md)
|
||||
|
||||
#### $$VERSION$$ v1.20-0-g2ab00a2
|
||||
#### $$VERSION$$ v1.21-dev-3-g79402ec
|
||||
|
||||
|
@ -180,22 +180,24 @@ You don't need all these files after you're finished with your cool new bot.
|
||||
|
||||
Let's create a stripped down version:
|
||||
|
||||
- delete all modules you do not need from 'modules', e.g. 'modules/inline.sh' if you don't use inline queries
|
||||
- delete not needed standard commands and messages from 'commands.sh'
|
||||
- delete not needed commands and functions from 'mycommands.sh'
|
||||
- run ```dev/make-standalone.sh``` to create a a stripped down version of your bo
|
||||
- delete all modules you do not need from `modules`, e.g. `modules/inline.sh` if you don't use inline queries
|
||||
- delete not needed standard commands and messages from `commands.sh`
|
||||
- delete not needed commands and functions from `mycommands.sh`
|
||||
- run `dev/make-standalone.sh` to create a a stripped down version of your bot
|
||||
|
||||
Now have a look at the directory 'standalone', here you find the files 'bashbot.sh' and 'commands.sh' containing everything to run your bot.
|
||||
[Download make-standalone.sh](https://github.com/topkecleon/telegram-bot-bash/blob/master/dev/make-standalone.sh) from github.
|
||||
|
||||
### Setup your develop environment
|
||||
|
||||
1. install the commands git, [shellcheck](5_practice.md#Test-your-Bot-with-shellcheck), bc, pandoc, bc, codespell
|
||||
1. install the commands git [shellcheck](5_practice.md#Test-your-Bot-with-shellcheck) bc pandoc zip codespell
|
||||
2. setup your [environment for UTF-8](4_expert.md#Setting-up-your-Environment)
|
||||
3. clone your bashbot fork to a new directory ```git clone https://github.com/<YOURNAME>/telegram-bot-bash.git```, replace ```<YOURNAME>``` with your username on github
|
||||
4. create and change to your develop branch ```git checkout -b <YOURBRANCH>```, replace ```<YOURBRANCH>``` with the name you want to name it, e.g. 'develop'
|
||||
5. give your (dev) fork a new version tag: ```git tag vx.xx```(optional)
|
||||
6. setup github hooks by running ```dev/install-hooks.sh``` (optional)
|
||||
3. clone your bashbot fork to a new directory `git clone https://github.com/<YOURNAME>/telegram-bot-bash.git`, replace `<YOURNAME>` with your username on github
|
||||
4. create and change to your develop branch `git checkout -b develop`
|
||||
5. give your (dev) fork a new version tag: `git tag v1.xx`
|
||||
6. setup github hooks by running `dev/install-hooks.sh`
|
||||
|
||||
Note for Debian: Debian Buster has an old shellcheck version, pls update from [buster-backports](https://backports.debian.org/Instructions/)
|
||||
|
||||
#### Test, Add, Push changes
|
||||
A typical bashbot develop loop looks as follow:
|
||||
@ -349,5 +351,5 @@ fi
|
||||
|
||||
#### [Prev Function Reference](6_reference.md)
|
||||
|
||||
#### $$VERSION$$ v1.20-0-g2ab00a2
|
||||
#### $$VERSION$$ v1.20-3-g232a16b
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user