doc: add send_file URL and file type

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2021-01-05 22:35:34 +01:00
parent 126f61f00c
commit 3d9f7848cf
3 changed files with 15 additions and 9 deletions

View File

@ -117,21 +117,27 @@ The main use case for send_message is to process the output of interactive chats
##### send_file
send_file 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).
send_file can send different file types using a local file or a http URL (_e.g. https://)
It's recommended to use __absolute path names__ (_starting with `/`_), as relative path names are threated as __relative to UPLOADDIR__ `data-bot-bash/upload`!
*usage:* send_file "${CHAT[ID]}" "file/URL" "caption" ["type"]
For security reasons the following restrictions apply:
Argument "type" is optional, if not given `send_file` detects file type by the file extension.
Supported file types are: photo (_png jpg jpeg gif pic_) audio (_mp3 flac_) sticker (_webp_) video (_mp4_) voice (_ogg_) or document.
It's recommended to use __absolute path names__ for local files (_starting with `/`_), as relative path names are threated as __relative to UPLOADDIR__ `data-bot-bash/upload`!
For security reasons the following restrictions apply to local files:
- 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
# recommended: absolute path
# send picture from web
send_file "${CHAT[ID]}" "https://dealz.rrr.de/assets/images/rbofd-1.gif" "My Bot"
# local file recommended: absolute path
send_file "${CHAT[ID]}" "/home/user/dog.jpg" "My Dog"
# relative to UPLOADDIR: data-bot-bash/upload/dog.jpg
@ -1187,5 +1193,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.21-0-gc85af77
#### $$VERSION$$ v1.25-dev-16-gdd19f0f

View File

@ -6,7 +6,7 @@
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
#
# shellcheck disable=SC1117
#### $$VERSION$$ v1.25-dev-15-g4582efd
#### $$VERSION$$ v1.25-dev-16-gdd19f0f
# will be automatically sourced from bashbot

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash
#### $$VERSION$$ v1.21-0-gc85af77
#### $$VERSION$$ v1.25-dev-14-g2fe6d4b
# include common functions and definitions
# shellcheck source=test/ALL-tests.inc.sh