Skip to content

Commit

Permalink
Merge pull request #404 from boy530/boy530-patch-1
Browse files Browse the repository at this point in the history
Update telegram.go
  • Loading branch information
feiyu563 authored Jun 19, 2024
2 parents b8a3f33 + cbeac61 commit 5e30930
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions conf/app-example.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ title=PrometheusAlert
#链接到告警平台地址
GraylogAlerturl=http://graylog.org
#钉钉告警 告警logo图标地址
logourl=https://raw.githubusercontent.com/feiyu563/PrometheusAlert/master/doc/alert-center.png
logourl=https://raw.githubusercontent.com/feiyu563/PrometheusAlert/master/doc/images/alert-center.png
#钉钉告警 恢复logo图标地址
rlogourl=https://raw.githubusercontent.com/feiyu563/PrometheusAlert/master/doc/alert-center.png
rlogourl=https://raw.githubusercontent.com/feiyu563/PrometheusAlert/master/doc/images/alert-center.png
#短信告警级别(等于3就进行短信告警) 告警级别定义 0 信息,1 警告,2 一般严重,3 严重,4 灾难
messagelevel=3
#电话告警级别(等于4就进行语音告警) 告警级别定义 0 信息,1 警告,2 一般严重,3 严重,4 灾难
Expand Down
2 changes: 2 additions & 0 deletions controllers/telegram.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ func SendTG(msg, logsign string) string {
if tgmsgmode == "0" {
// 推送给个人
tgusermsg := tgbotapi.NewMessage(tguserid, msg)
tgusermsg.ParseMode = "Markdown" // 设置解析模式为Markdown
_, err = botapi.Send(tgusermsg)
} else {
// 推送给channel
tgchanmsg := tgbotapi.NewMessageToChannel(tgchanname, msg)
tgchanmsg.ParseMode = "Markdown" // 设置解析模式为Markdown
_, err = botapi.Send(tgchanmsg)
}
if err != nil {
Expand Down

0 comments on commit 5e30930

Please sign in to comment.