mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-07-29 04:21:48 +08:00
30 lines
802 B
Bash
30 lines
802 B
Bash
#!/bin/sh
|
|
# Copyright (C) 2023-2025 muink https://github.com/muink
|
|
#
|
|
# Port update notify script
|
|
#
|
|
# depends
|
|
|
|
. /usr/lib/natmap/common.sh
|
|
|
|
start() {
|
|
local retry='--connect-timeout 3 --retry 5'
|
|
|
|
# 如果 CUESTOM_PROXY 不为空,则添加 -x 参数
|
|
local proxy_param=${CUESTOM_PROXY:+-x $CUESTOM_PROXY}
|
|
|
|
$CURL $retry -L -o /dev/null -X POST $proxy_param \
|
|
-H 'Content-Type: application/json' \
|
|
-d '{"chat_id":"'"${CHAT_ID}"'","text":"'"${text}"'","parse_mode":"HTML","disable_notification":"false"}' \
|
|
--url "https://${custom_domain:-api.telegram.org}/bot${TOKEN}/sendMessage"
|
|
}
|
|
|
|
|
|
# All external parameters required
|
|
ALL_PARAMS="custom_domain text tokens"
|
|
eval "$(JSON_EXPORT "$1")"; shift
|
|
# All external tokens required
|
|
INIT_GLOBAL_VAR TOKEN CHAT_ID CUESTOM_PROXY
|
|
eval "$tokens"
|
|
start "$@"
|