From af731fb3359c154cd52f17487447b62a55220b26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=81=AA=E6=98=8E=E5=A4=A7=E7=94=B7=E5=AD=A9?= Date: Sun, 21 Jul 2024 20:50:02 +0800 Subject: [PATCH 1/2] Update telegram.go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Markdown对格式要求很严格,修复在用到telegram时选择是否用到markdown --- controllers/telegram.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/controllers/telegram.go b/controllers/telegram.go index 4516e125..f2c0234c 100644 --- a/controllers/telegram.go +++ b/controllers/telegram.go @@ -21,18 +21,23 @@ func SendTG(msg, logsign string) string { tguserid, _ := beego.AppConfig.Int64("TG_USERID") tgchanname := beego.AppConfig.String("TG_CHANNAME") tgapi := beego.AppConfig.String("TG_API_PROXY") + tgParseMode := beego.AppConfig.String("TG_PARSE_MODE") botapi := newBot(tgbottoken, logsign, tgapi) var err error if tgmsgmode == "0" { // 推送给个人 tgusermsg := tgbotapi.NewMessage(tguserid, msg) - tgusermsg.ParseMode = "Markdown" // 设置解析模式为Markdown + if tgParseMode == "1" { + tgusermsg.ParseMode = "Markdown" // 设置解析模式为Markdown + } _, err = botapi.Send(tgusermsg) } else { // 推送给channel tgchanmsg := tgbotapi.NewMessageToChannel(tgchanname, msg) - tgchanmsg.ParseMode = "Markdown" // 设置解析模式为Markdown + if tgParseMode == "1" { + tgchanmsg.ParseMode = "Markdown" // 设置解析模式为Markdown + } _, err = botapi.Send(tgchanmsg) } if err != nil { From 72c247a5aaf215da37f7d3ec45031a0308b026c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=81=AA=E6=98=8E=E5=A4=A7=E7=94=B7=E5=AD=A9?= Date: Sun, 21 Jul 2024 20:53:30 +0800 Subject: [PATCH 2/2] Update README.MD MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit copy 应该为cp --- README.MD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.MD b/README.MD index aa177119..a6ee7c6c 100644 --- a/README.MD +++ b/README.MD @@ -97,7 +97,7 @@ make docker/docker-push/docker-test # 本地测试运行 make clean && make build -copy conf/app-example.conf conf/app.conf +cp conf/app-example.conf conf/app.conf ./PrometheusAlert # 测试应用健康