Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Dominika Liberda
telegram.sh
Commits
ac6d4bca
Commit
ac6d4bca
authored
Apr 08, 2022
by
Dominika Liberda
💽
Browse files
* fixes in how curl are called because... semicolons
parent
6b1dfbf7
Changes
1
Hide whitespace changes
Inline
Side-by-side
tg.sh
View file @
ac6d4bca
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment