tg推送支持markdown格式

This commit is contained in:
lxk0301
2021-03-16 12:08:34 +08:00
parent 2e33bc67ca
commit 5f90676942
2 changed files with 6 additions and 6 deletions

View File

@ -99,7 +99,7 @@ function showMsg() {
// 云端大于10元无门槛红包时进行通知推送
// if ($.isNode() && $.totalScore >= 20000 && nowTimes.getHours() >= 20) await notify.sendNotify(`${$.name} - 京东账号${$.index} - ${$.nickName}`, `京东账号${$.index} ${$.nickName}\n当前${$.name}${$.totalScore}个\n可兑换无门槛红包${$.totalScore / 1000}元\n点击链接即可去兑换(注:此红包具有时效性)\n↓↓↓ \n\n ${openUrl} \n\n ↑↑↑`, { url: openUrl })
if ($.isNode() && nowTimes.getHours() >= 20 && (process.env.DDQ_NOTIFY_CONTROL ? process.env.DDQ_NOTIFY_CONTROL === 'false' : !!1)) {
allMessage += `京东账号${$.index} ${$.nickName}\n当前${$.name}${$.totalScore}\n可兑换无门槛红包:${$.totalScore / 1000}\n(京东APP->领券->左上角点点券.注:此红包具有时效性)${$.index !== cookiesArr.length ? '\n\n' : `\n↓↓↓ \n\n ${openUrl} \n\n ↑↑↑`}`
allMessage += `京东账号${$.index} ${$.nickName}\n当前${$.name}${$.totalScore}\n可兑换无门槛红包:${$.totalScore / 1000}\n(京东APP->领券->左上角点点券.注:此红包具有时效性)${$.index !== cookiesArr.length ? '\n\n' : `\n↓↓↓ \n\n "https://h5.m.jd.com/babelDiy/Zeus/41Lkp7DumXYCFmPYtU3LTcnTTXTX/index.html" \n\n ↑↑↑`}`
}
resolve()
})

View File

@ -2,7 +2,7 @@
* @Author: lxk0301 https://gitee.com/lxk0301
* @Date: 2020-08-19 16:12:40
* @Last Modified by: lxk0301
* @Last Modified time: 2021-3-15 9:52:54
* @Last Modified time: 2021-3-16 9:52:54
*/
const querystring = require("querystring");
const $ = new Env();
@ -311,18 +311,18 @@ 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`,
body: `chat_id=${TG_USER_ID}&text=${text}\n\n${desp}&disable_web_page_preview=true&parse_mode=Markdown`,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}
if (process.env.TG_PROXY_HOST && process.env.TG_PROXY_PORT) {
if (TG_PROXY_HOST && TG_PROXY_PORT) {
const tunnel = require("tunnel");
const agent = {
https: tunnel.httpsOverHttp({
proxy: {
host: process.env.TG_PROXY_HOST,
port: process.env.TG_PROXY_PORT * 1
host: TG_PROXY_HOST,
port: TG_PROXY_PORT * 1
}
})
}