mirror of
https://github.com/acmesh-official/acme.sh.git
synced 2025-04-30 22:02:45 +00:00
Merge 3f77166f2cf7c17afe59a04217171f3d7d71bc23 into fca53a0c2cb75ef9a7232c8cb5a0c096d4293152
This commit is contained in:
commit
fdba3d0f03
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#TELEGRAM_BOT_APITOKEN=""
|
#TELEGRAM_BOT_APITOKEN=""
|
||||||
#TELEGRAM_BOT_CHATID=""
|
#TELEGRAM_BOT_CHATID=""
|
||||||
|
#TELEGRAM_BOT_URLBASE=""
|
||||||
|
|
||||||
telegram_send() {
|
telegram_send() {
|
||||||
_subject="$1"
|
_subject="$1"
|
||||||
@ -27,6 +28,12 @@ telegram_send() {
|
|||||||
fi
|
fi
|
||||||
_saveaccountconf_mutable TELEGRAM_BOT_CHATID "$TELEGRAM_BOT_CHATID"
|
_saveaccountconf_mutable TELEGRAM_BOT_CHATID "$TELEGRAM_BOT_CHATID"
|
||||||
|
|
||||||
|
TELEGRAM_BOT_URLBASE="${TELEGRAM_BOT_URLBASE:-$(_readaccountconf_mutable TELEGRAM_BOT_URLBASE)}"
|
||||||
|
if [ -z "$TELEGRAM_BOT_URLBASE" ]; then
|
||||||
|
TELEGRAM_BOT_URLBASE="https://api.telegram.org"
|
||||||
|
fi
|
||||||
|
_saveaccountconf_mutable TELEGRAM_BOT_URLBASE "$TELEGRAM_BOT_URLBASE"
|
||||||
|
|
||||||
_subject="$(printf "%s" "$_subject" | sed 's/\\/\\\\\\\\/g' | sed 's/\]/\\\\\]/g' | sed 's/\([_*[()~`>#+--=|{}.!]\)/\\\\\1/g')"
|
_subject="$(printf "%s" "$_subject" | sed 's/\\/\\\\\\\\/g' | sed 's/\]/\\\\\]/g' | sed 's/\([_*[()~`>#+--=|{}.!]\)/\\\\\1/g')"
|
||||||
_content="$(printf "%s" "$_content" | sed 's/\\/\\\\\\\\/g' | sed 's/\]/\\\\\]/g' | sed 's/\([_*[()~`>#+--=|{}.!]\)/\\\\\1/g')"
|
_content="$(printf "%s" "$_content" | sed 's/\\/\\\\\\\\/g' | sed 's/\]/\\\\\]/g' | sed 's/\([_*[()~`>#+--=|{}.!]\)/\\\\\1/g')"
|
||||||
_content="$(printf "*%s*\n%s" "$_subject" "$_content" | _json_encode)"
|
_content="$(printf "*%s*\n%s" "$_subject" "$_content" | _json_encode)"
|
||||||
@ -38,7 +45,7 @@ telegram_send() {
|
|||||||
_debug "$_data"
|
_debug "$_data"
|
||||||
|
|
||||||
export _H1="Content-Type: application/json"
|
export _H1="Content-Type: application/json"
|
||||||
_telegram_bot_url="https://api.telegram.org/bot${TELEGRAM_BOT_APITOKEN}/sendMessage"
|
_telegram_bot_url="${TELEGRAM_BOT_URLBASE}/bot${TELEGRAM_BOT_APITOKEN}/sendMessage"
|
||||||
if _post "$_data" "$_telegram_bot_url" >/dev/null; then
|
if _post "$_data" "$_telegram_bot_url" >/dev/null; then
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
_message=$(printf "%s\n" "$response" | sed -n 's/.*"ok":\([^,]*\).*/\1/p')
|
_message=$(printf "%s\n" "$response" | sed -n 's/.*"ok":\([^,]*\).*/\1/p')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user