diff --git a/tg.sh b/tg.sh index 38435e4..8f87ad3 100755 --- a/tg.sh +++ b/tg.sh @@ -6,7 +6,7 @@ API_URL="https://api.telegram.org" # _escape_text(input_text) function _escape() { - sed -E 's/[`~!@#$%^&*():;<>.,?\|{}=+-_]/\\&/g' <<< "$1" + sed -E 's/[`~!@#$%^&*():<>.,?\|{}=+_-]/\\&/g' <<< "$1" } # _unescape_text(input_text) @@ -18,6 +18,8 @@ function _unescape_text() { function tg_send() { if [[ $ESCAPE_ALL == true ]]; then text="$(_escape "$2")" + echo "$2" + echo "$text" else text="$2" fi @@ -35,23 +37,23 @@ function tg_send() { if [[ $3 == "remoteFileId" ]]; then curl -s \ - -F chat_id=$1 \ - -F caption="$text" \ + --form-string chat_id=$1 \ + --form-string caption="$text" \ -F parse_mode=$PARSE_MODE \ -F $type_snake=$5 \ "${API_URL}/bot${TELEGRAM_TOKEN}/send${type}" else curl -s \ - -F chat_id=$1 \ - -F caption="$text" \ + --form-string chat_id=$1 \ + --form-string caption="$text" \ -F parse_mode=$PARSE_MODE \ -F $type_snake=@$3 \ "${API_URL}/bot${TELEGRAM_TOKEN}/send${type}" fi else curl -s \ - -F chat_id=$1 \ - -F text="$text" \ + --form-string chat_id=$1 \ + --form-string text="$text" \ -F parse_mode=$PARSE_MODE \ "${API_URL}/bot${TELEGRAM_TOKEN}/sendMessage" fi