diff --git a/bin/send_file.sh b/bin/send_file.sh index 585ddf4..d419b92 100755 --- a/bin/send_file.sh +++ b/bin/send_file.sh @@ -3,14 +3,17 @@ # # FILE: bin/send_file.sh # -# USAGE: send_file.sh [-h|--help] "CHAT[ID]" "file" "caption ...." [debug] +# USAGE: send_file.sh [-h|--help] "CHAT[ID]" "file|URL" "caption ...." [type] [debug] # # DESCRIPTION: send a file to the given user/group # # OPTIONS: CHAT[ID] - ID number of CHAT or BOTADMIN to send to yourself -# file - file to send, must be an absolute path or relative to pwd +# file - local file to send, must be an absolute path or relative to pwd # Note: must not contain .. or . and located below BASHBOT_ETC +# URL - send an URL instead local file +# # caption - message to send with file +# type - photo, video, sticker, voice, document (optional) # # -h - display short help # --help - this help @@ -21,7 +24,7 @@ # AUTHOR: KayM (gnadelwartz), kay@rrr.de # CREATED: 25.12.2020 20:24 # -#### $$VERSION$$ v1.25-dev-15-g4582efd +#### $$VERSION$$ v1.25-dev-18-g3d9f784 #=============================================================================== #### @@ -32,7 +35,7 @@ case "$1" in printf "missing arguments\n" ;& "-h"*) - printf 'usage: send_file [-h|--help] "CHAT[ID]" "file" "caption ...." [debug]\n' + printf 'usage: send_file [-h|--help] "CHAT[ID]" "file" "caption ...." [type] [debug]\n' exit 1 ;; '--h'*) @@ -43,7 +46,7 @@ esac # set bashbot environment # shellcheck disable=SC1090 -source "${0%/*}/bashbot_env.inc.sh" "$4" # $4 debug +source "${0%/*}/bashbot_env.inc.sh" "$5" # $5 debug #### # ready, do stuff here ----- @@ -58,7 +61,7 @@ FILE="$2" [[ ! ( "$2" == "/"* || "$2" =~ ^https*:// ) ]] && FILE="${PWD}/$2" # send message in selected format -"${SEND}" "${CHAT}" "${FILE}" "$3" +"${SEND}" "${CHAT}" "${FILE}" "$3" "$4" # output send message result jssh_printDB "BOTSENT" | sort -r diff --git a/doc/2_usage.md b/doc/2_usage.md index e8a39e3..848c1b1 100644 --- a/doc/2_usage.md +++ b/doc/2_usage.md @@ -33,6 +33,7 @@ Have FUN! ├── bin # ready to use scripts, use `scriptname --help` for help │   ├── send_message.sh # send message to given chat │   ├── edit_message.sh # replace given message id in given chat +│   ├── delete_message.sh # delete given message id in given chat │   ├── send_broadcast.sh # send message to all known chats │   ├── send_file.sh # send file to given chat │   ├── bashbot_stats.sh # does what it says ... @@ -341,5 +342,5 @@ send_action "${CHAT[ID]}" "action" #### [Prev Create Bot](1_firstbot.md) #### [Next Advanced Usage](3_advanced.md) -#### $$VERSION$$ v1.21-0-gc85af77 +#### $$VERSION$$ v1.25-dev-18-g3d9f784