Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
64ad8b1d
Unverified
Commit
64ad8b1d
authored
Apr 09, 2021
by
neil
Committed by
GitHub
Apr 09, 2021
Browse files
Merge pull request #3479 from mjbnz/dev
Update Telegram notification
parents
e7123857
fb079f9e
Changes
1
Hide whitespace changes
Inline
Side-by-side
notify/telegram.sh
View file @
64ad8b1d
...
...
@@ -27,15 +27,18 @@ telegram_send() {
fi
_saveaccountconf_mutable TELEGRAM_BOT_CHATID
"
$TELEGRAM_BOT_CHATID
"
_content
=
"
$(
printf
"%s"
"
$_content
"
|
sed
-e
's/*/\\\\*/'
)
"
_content
=
"
$(
printf
"*%s*
\n
%s"
"
$_subject
"
"
$_content
"
| _json_encode
)
"
_data
=
"{
\"
text
\"
:
\"
$_content
\"
, "
_data
=
"
$_data
\"
chat_id
\"
:
\"
$TELEGRAM_BOT_CHATID
\"
, "
_data
=
"
$_data
\"
parse_mode
\"
:
\"
markdown
\"
, "
_data
=
"
$_data
\"
disable_web_page_preview
\"
:
\"
1
\"
}"
_debug
"
$_data
"
export
_H1
=
"Content-Type: application/json"
_telegram_bot_url
=
"https://api.telegram.org/bot
${
TELEGRAM_BOT_APITOKEN
}
/sendMessage"
if
_post
"
$_data
"
"
$_telegram_bot_url
"
;
then
if
_post
"
$_data
"
"
$_telegram_bot_url
"
>
/dev/null
;
then
# shellcheck disable=SC2154
_message
=
$(
printf
"%s
\n
"
"
$response
"
|
sed
-n
's/.*"ok":\([^,]*\).*/\1/p'
)
if
[
"
$_message
"
=
"true"
]
;
then
...
...
Write
Preview
Markdown
is supported
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