mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2025-01-15 02:13:44 +00:00
bin: send_file add URL and file type
This commit is contained in:
parent
3d9f7848cf
commit
ac02f5a3d3
@ -3,14 +3,17 @@
|
|||||||
#
|
#
|
||||||
# FILE: bin/send_file.sh
|
# 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
|
# DESCRIPTION: send a file to the given user/group
|
||||||
#
|
#
|
||||||
# OPTIONS: CHAT[ID] - ID number of CHAT or BOTADMIN to send to yourself
|
# 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
|
# Note: must not contain .. or . and located below BASHBOT_ETC
|
||||||
|
# URL - send an URL instead local file
|
||||||
|
#
|
||||||
# caption - message to send with file
|
# caption - message to send with file
|
||||||
|
# type - photo, video, sticker, voice, document (optional)
|
||||||
#
|
#
|
||||||
# -h - display short help
|
# -h - display short help
|
||||||
# --help - this help
|
# --help - this help
|
||||||
@ -21,7 +24,7 @@
|
|||||||
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
|
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
|
||||||
# CREATED: 25.12.2020 20:24
|
# 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"
|
printf "missing arguments\n"
|
||||||
;&
|
;&
|
||||||
"-h"*)
|
"-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
|
exit 1
|
||||||
;;
|
;;
|
||||||
'--h'*)
|
'--h'*)
|
||||||
@ -43,7 +46,7 @@ esac
|
|||||||
|
|
||||||
# set bashbot environment
|
# set bashbot environment
|
||||||
# shellcheck disable=SC1090
|
# 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 -----
|
# ready, do stuff here -----
|
||||||
@ -58,7 +61,7 @@ FILE="$2"
|
|||||||
[[ ! ( "$2" == "/"* || "$2" =~ ^https*:// ) ]] && FILE="${PWD}/$2"
|
[[ ! ( "$2" == "/"* || "$2" =~ ^https*:// ) ]] && FILE="${PWD}/$2"
|
||||||
|
|
||||||
# send message in selected format
|
# send message in selected format
|
||||||
"${SEND}" "${CHAT}" "${FILE}" "$3"
|
"${SEND}" "${CHAT}" "${FILE}" "$3" "$4"
|
||||||
|
|
||||||
# output send message result
|
# output send message result
|
||||||
jssh_printDB "BOTSENT" | sort -r
|
jssh_printDB "BOTSENT" | sort -r
|
||||||
|
@ -33,6 +33,7 @@ Have FUN!
|
|||||||
├── bin # ready to use scripts, use `scriptname --help` for help
|
├── bin # ready to use scripts, use `scriptname --help` for help
|
||||||
│ ├── send_message.sh # send message to given chat
|
│ ├── send_message.sh # send message to given chat
|
||||||
│ ├── edit_message.sh # replace given message id in 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_broadcast.sh # send message to all known chats
|
||||||
│ ├── send_file.sh # send file to given chat
|
│ ├── send_file.sh # send file to given chat
|
||||||
│ ├── bashbot_stats.sh # does what it says ...
|
│ ├── bashbot_stats.sh # does what it says ...
|
||||||
@ -341,5 +342,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.21-0-gc85af77
|
#### $$VERSION$$ v1.25-dev-18-g3d9f784
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user