Skip to content

Commit

Permalink
Merge pull request #418 from boy530/boy530-patch-2
Browse files Browse the repository at this point in the history
Boy530 patch 2
  • Loading branch information
feiyu563 authored Jul 22, 2024
2 parents ad82443 + 72c247a commit 244f2f7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -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

# 测试应用健康
Expand Down
9 changes: 7 additions & 2 deletions controllers/telegram.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 244f2f7

Please sign in to comment.