From 24f33431deae5ad9786bb690bede09fb499c616d Mon Sep 17 00:00:00 2001 From: kan3Git <57619461+kan3Git@users.noreply.github.com> Date: Sat, 26 Mar 2022 17:23:54 +0800 Subject: [PATCH] =?UTF-8?q?tg=E5=8F=91=E9=80=81=E6=B6=88=E6=81=AF=E6=94=B9?= =?UTF-8?q?json=20(#1269)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 发现有带&的消息都会漏掉&后面的内容,改为JSON发送 --- sample/notify.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sample/notify.js b/sample/notify.js index 99eb8e2a..1982f58c 100644 --- a/sample/notify.js +++ b/sample/notify.js @@ -529,9 +529,13 @@ function tgBotNotify(text, desp) { if (TG_BOT_TOKEN && TG_USER_ID) { const options = { url: `https://${TG_API_HOST}/bot${TG_BOT_TOKEN}/sendMessage`, - body: `chat_id=${TG_USER_ID}&text=${text}\n\n${desp}&disable_web_page_preview=true`, + json: { + chat_id: `${TG_USER_ID}`, + text: `${text}\n\n${desp}`, + disable_web_page_preview:true, + }, headers: { - 'Content-Type': 'application/x-www-form-urlencoded', + 'Content-Type': 'application/json', }, timeout, };