Commit ac6d4bca authored by Dominika Liberda's avatar Dominika Liberda 💽
Browse files

* fixes in how curl are called because... semicolons

parent 6b1dfbf7
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment