From 2dea6e382b4a67bebe57dc04b58dc478b8f9273e Mon Sep 17 00:00:00 2001 From: hotyue <52734432+hotyue@users.noreply.github.com> Date: Sat, 25 Apr 2026 05:48:53 +0000 Subject: [PATCH] =?UTF-8?q?feat(agent):=20=E4=BC=98=E5=8C=96=E6=AF=8F?= =?UTF-8?q?=E6=97=A5=E7=AE=80=E6=8A=A5=E6=8E=A8=E9=80=81=E9=93=BE=E8=B7=AF?= =?UTF-8?q?=EF=BC=8C=E5=BA=95=E9=83=A8=E8=BF=BD=E5=8A=A0=20[=E4=B8=80?= =?UTF-8?q?=E9=94=AE=E5=94=A4=E9=86=92=E6=8E=A7=E5=88=B6=E5=8F=B0]=20?= =?UTF-8?q?=E4=BA=A4=E4=BA=92=E5=BC=8F=E5=86=85=E8=81=94=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/tg_report.sh | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/core/tg_report.sh b/core/tg_report.sh index 036be73..93a6300 100755 --- a/core/tg_report.sh +++ b/core/tg_report.sh @@ -200,11 +200,24 @@ else 💡 *哨兵正在后台默默守护您的资产。*" fi -# 5. 调用 API 推送 (接入安全网关) +# 5. 调用 API 推送 (接入安全网关,挂载交互式控制台按钮) +JSON_PAYLOAD=$(jq -n \ + --arg cid "$CHAT_ID" \ + --arg txt "$MSG" \ + --arg cb "manage:${NODE_NAME}" \ + '{ + chat_id: $cid, + text: $txt, + parse_mode: "Markdown", + disable_web_page_preview: true, + reply_markup: { + inline_keyboard: [[{text: "⚙️ 调出该节点控制台", callback_data: $cb}]] + } + }') + RESPONSE=$(curl -s -m 10 -X POST "${TG_API_URL}" \ - -d "chat_id=${CHAT_ID}" \ - -d "text=${MSG}" \ - -d "parse_mode=Markdown") + -H "Content-Type: application/json" \ + -d "$JSON_PAYLOAD") if [[ "$RESPONSE" != *"\"ok\":true"* ]]; then echo "❌ 战报发送失败!API 响应: $RESPONSE" >> "${INSTALL_DIR}/logs/error.log"