doc: more/better download_file examples
This commit is contained in:
parent
baa4e14ebc
commit
54673ac396
|
@ -186,14 +186,15 @@ The following variables are set if the message contains optional parts:
|
||||||
* `${FORWARD[LAST_NAME]}`: Original user's' last name
|
* `${FORWARD[LAST_NAME]}`: Original user's' last name
|
||||||
* `${FORWARD[USERNAME]}`: Original user's username
|
* `${FORWARD[USERNAME]}`: Original user's username
|
||||||
* `$CAPTION`: Picture, Audio, Video, File Captions
|
* `$CAPTION`: Picture, Audio, Video, File Captions
|
||||||
* `$URLS`: This array contains `path` to document, audio file, voice recording and sticker for download from telegram server.
|
* `$URLS`: This array contains the `path` on Telegram server for files send to chat, e.g. photo, video, audio file.
|
||||||
* `${URLS[AUDIO]}`: Path to audio file
|
* `${URLS[AUDIO]}`: Path to audio file
|
||||||
* `${URLS[VIDEO]}`: Path to video
|
* `${URLS[VIDEO]}`: Path to video
|
||||||
* `${URLS[PHOTO]}`: Path to photo (maximum quality)
|
* `${URLS[PHOTO]}`: Path to photo (maximum quality)
|
||||||
* `${URLS[VOICE]}`: Path to voice recording
|
* `${URLS[VOICE]}`: Path to voice recording
|
||||||
* `${URLS[STICKER]}`: Path to sticker
|
* `${URLS[STICKER]}`: Path to sticker
|
||||||
* `${URLS[DOCUMENT]}`: Path to any other file
|
* `${URLS[DOCUMENT]}`: Path to any other file
|
||||||
**Important:** This is NO MORE a full URL, you must use `download_file` or `${URL}/${URLS[xxx]}` for manual download.
|
**Important:** This is NOT a full URL, you must use `download_file "${URLS[xxx]}"` or prefix path with telegram api url for manual download
|
||||||
|
(_e.g. `getJson "${URL}/${URLS[xxx]}" >file`_).
|
||||||
* `$CONTACT`: This array contains info about contacts sent in a chat.
|
* `$CONTACT`: This array contains info about contacts sent in a chat.
|
||||||
* `${CONTACT[ID]}`: User id
|
* `${CONTACT[ID]}`: User id
|
||||||
* `${CONTACT[NUMBER]}`: Phone number
|
* `${CONTACT[NUMBER]}`: Phone number
|
||||||
|
@ -239,7 +240,8 @@ e.g. if a new user joins a chat MESSAGE is set to "/_new_chat_user".
|
||||||
* `${MESSAGE}`: /_new_chat_title SENDER TEXT
|
* `${MESSAGE}`: /_new_chat_title SENDER TEXT
|
||||||
* `${SERVICE[NEWPHOTO]}`: New Chat Picture
|
* `${SERVICE[NEWPHOTO]}`: New Chat Picture
|
||||||
* `${MESSAGE}`: /_new_chat_picture SENDER URL
|
* `${MESSAGE}`: /_new_chat_picture SENDER URL
|
||||||
**Important:** SERVICE[NEWPHOTO] is NOT a full URL, you must use `download_file` or `${URL}/${SERVICE[NEWPHOTO]}` for manual download.
|
**Important:** SERVICE[NEWPHOTO] is NOT a full URL, you must use `download_file "${SERVICE[NEWPHOTO]}"` or prefix path with telegram api url for manual download
|
||||||
|
(_e.g. `getJson "${URL}/${SERVICE[NEWPHOTO]}" >file`_).
|
||||||
* `${SERVICE[PINNED]}`: Pinned MESSAGE ID
|
* `${SERVICE[PINNED]}`: Pinned MESSAGE ID
|
||||||
* `${MESSAGE}`: /_new_pinned_message SENDER ID
|
* `${MESSAGE}`: /_new_pinned_message SENDER ID
|
||||||
* `${PINNED[ID]}`: Id of pinned message
|
* `${PINNED[ID]}`: Id of pinned message
|
||||||
|
@ -374,5 +376,5 @@ send_action "${CHAT[ID]}" "action"
|
||||||
#### [Prev Create Bot](1_firstbot.md)
|
#### [Prev Create Bot](1_firstbot.md)
|
||||||
#### [Next Advanced Usage](3_advanced.md)
|
#### [Next Advanced Usage](3_advanced.md)
|
||||||
|
|
||||||
#### $$VERSION$$ v1.41-dev-3-gbc40a3f
|
#### $$VERSION$$ v1.41-dev-4-gbaa4e14
|
||||||
|
|
||||||
|
|
|
@ -571,7 +571,6 @@ Returns the new invite link as String on success.
|
||||||
|
|
||||||
|
|
||||||
##### pin_chat_message
|
##### pin_chat_message
|
||||||
# $1 chat, $2 message_id
|
|
||||||
`pin_chat_message` add a message to the list of pinned messages in a chat.
|
`pin_chat_message` add a message to the list of pinned messages in a chat.
|
||||||
|
|
||||||
*usage:* pin_chat_message "CHAT[ID]" "message_id"
|
*usage:* pin_chat_message "CHAT[ID]" "message_id"
|
||||||
|
@ -1424,6 +1423,8 @@ echo "$file" -> ./data-bot-bash/photo-file_1234.jpg
|
||||||
file="$(download_file "${photo}"
|
file="$(download_file "${photo}"
|
||||||
echo "$file" -> ./data-bot-bash/jkdfhihsdkf-photo-file_1234.jpg
|
echo "$file" -> ./data-bot-bash/jkdfhihsdkf-photo-file_1234.jpg
|
||||||
|
|
||||||
|
ls data-bot-bash/*.jpg
|
||||||
|
photo-file_1234.jpg jkdfhihsdkf-photo-file_1234.jpg
|
||||||
|
|
||||||
########
|
########
|
||||||
# download from other sources (full URL)
|
# download from other sources (full URL)
|
||||||
|
@ -1432,6 +1433,20 @@ echo "$file" -> ./data-bot-bash/avatar.jpg
|
||||||
|
|
||||||
file="$(download "https://avatars.githubusercontent.com/u/13046303" "avatar.jpg")"
|
file="$(download "https://avatars.githubusercontent.com/u/13046303" "avatar.jpg")"
|
||||||
echo "$file" -> ./data-bot-bash/jhsdfjkakshdfkja-avatar.jpg
|
echo "$file" -> ./data-bot-bash/jhsdfjkakshdfkja-avatar.jpg
|
||||||
|
|
||||||
|
ls data-bot-bash/*.jpg
|
||||||
|
photo-file_1234.jpg jkdfhihsdkf-photo-file_1234.jpg
|
||||||
|
avatar.jpg jhsdfjkakshdfkja-avatar.jpg
|
||||||
|
|
||||||
|
#######
|
||||||
|
# manually download files to current directory (not recommended)
|
||||||
|
getJson "https://avatars.githubusercontent.com/u/13046303" >"avatar.jpg"
|
||||||
|
getJson "i${URL}/${photo}" >"downloaded_photo.jpg"
|
||||||
|
|
||||||
|
ls *
|
||||||
|
JSON.sh/ addons/ bin/ data-bot_bash/ doc/ modules/ scripts/
|
||||||
|
avatar.jpg bashbot.sh commands.sh downloaded_photo.jpg LICENSE mycommands.conf mycommands.sh mycommands.sh
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
##### _exec_if_function
|
##### _exec_if_function
|
||||||
|
@ -1598,5 +1613,5 @@ The name of your bot is available as bash variable "$ME", there is no need to ca
|
||||||
#### [Prev Best Practice](5_practice.md)
|
#### [Prev Best Practice](5_practice.md)
|
||||||
#### [Next Notes for Developers](7_develop.md)
|
#### [Next Notes for Developers](7_develop.md)
|
||||||
|
|
||||||
#### $$VERSION$$ v1.41-dev-3-gbc40a3f
|
#### $$VERSION$$ v1.41-dev-4-gbaa4e14
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue