+ added file upload by id
This commit is contained in:
parent
40bbce9039
commit
53cfd77b2f
28
tg.sh
28
tg.sh
|
@ -12,7 +12,7 @@ function _unescape_text() {
|
||||||
sed -E 's/\\/&lauraiscute/g;s/\\lauraiscute\\lauraiscute\\lauraiscute/\\/;s/\\lauraiscute//g' <<< "$1"
|
sed -E 's/\\/&lauraiscute/g;s/\\lauraiscute\\lauraiscute\\lauraiscute/\\/;s/\\lauraiscute//g' <<< "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
# tg_send(chat, text, file, type)
|
# tg_send(chat, text, file, type, [id])
|
||||||
function tg_send() {
|
function tg_send() {
|
||||||
text="$(_escape_text "$2")"
|
text="$(_escape_text "$2")"
|
||||||
if [[ $3 != '' ]]; then
|
if [[ $3 != '' ]]; then
|
||||||
|
@ -25,13 +25,23 @@ function tg_send() {
|
||||||
[[ $4 == 'animation' ]] && local type="Animation"
|
[[ $4 == 'animation' ]] && local type="Animation"
|
||||||
[[ $4 == 'voice' ]] && local type="Voice"
|
[[ $4 == 'voice' ]] && local type="Voice"
|
||||||
[[ $4 == 'video_note' ]] && local type="VideoNote"
|
[[ $4 == 'video_note' ]] && local type="VideoNote"
|
||||||
|
[[ $4 == 'sticker' ]] && local type="Sticker"
|
||||||
curl -s \
|
|
||||||
-F chat_id=$1 \
|
if [[ $3 == "remoteFileId" ]]; then
|
||||||
-F caption="$text" \
|
curl -s \
|
||||||
-F parse_mode=$PARSE_MODE \
|
-F chat_id=$1 \
|
||||||
-F $type_snake=@$3 \
|
-F caption="$text" \
|
||||||
"https://api.telegram.org/bot${TELEGRAM_TOKEN}/send${type}"
|
-F parse_mode=$PARSE_MODE \
|
||||||
|
-F $type_snake=$5 \
|
||||||
|
"https://api.telegram.org/bot${TELEGRAM_TOKEN}/send${type}"
|
||||||
|
else
|
||||||
|
curl -s \
|
||||||
|
-F chat_id=$1 \
|
||||||
|
-F caption="$text" \
|
||||||
|
-F parse_mode=$PARSE_MODE \
|
||||||
|
-F $type_snake=@$3 \
|
||||||
|
"https://api.telegram.org/bot${TELEGRAM_TOKEN}/send${type}"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
curl -s \
|
curl -s \
|
||||||
-F chat_id=$1 \
|
-F chat_id=$1 \
|
||||||
|
@ -302,7 +312,7 @@ function tg_start() {
|
||||||
event[sticker_is_animated]="${_tmp[4]}"
|
event[sticker_is_animated]="${_tmp[4]}"
|
||||||
event[sticker_file_id]="${_tmp[5]}"
|
event[sticker_file_id]="${_tmp[5]}"
|
||||||
event[sticker_file_unique_id]="${_tmp[6]}"
|
event[sticker_file_unique_id]="${_tmp[6]}"
|
||||||
event[sticker_file_size]="${_tmp[6]}"
|
event[sticker_file_size]="${_tmp[7]}"
|
||||||
unset _tmp
|
unset _tmp
|
||||||
|
|
||||||
_on_sticker
|
_on_sticker
|
||||||
|
|
Loading…
Reference in a new issue