uptime kuma webhook status message
This commit is contained in:
parent
a497049c66
commit
3c77451fa2
|
@ -337,6 +337,7 @@ func (h MessageHandler) UptimeKumaWebHook(g *gin.Context) ginresp.HTTPResponse {
|
|||
type uptimeKumaWebhookBody struct {
|
||||
Heartbeat *struct {
|
||||
Time string `json:"time"`
|
||||
Status int `json:"status"`
|
||||
Msg string `json:"msg"`
|
||||
Timezone string `json:"timezone"`
|
||||
TimezoneOffset string `json:"timezoneOffset"`
|
||||
|
@ -358,7 +359,7 @@ func (h MessageHandler) UptimeKumaWebHook(g *gin.Context) ginresp.HTTPResponse {
|
|||
return *httpErr
|
||||
}
|
||||
|
||||
title := fmt.Sprintf("[UptimeKuma] %v down!", b.Monitor.Name)
|
||||
var title = ""
|
||||
|
||||
var content = ""
|
||||
content += fmt.Sprintf("%v\n", b.Msg)
|
||||
|
@ -368,6 +369,15 @@ func (h MessageHandler) UptimeKumaWebHook(g *gin.Context) ginresp.HTTPResponse {
|
|||
content += fmt.Sprintf("url: %v\n", b.Monitor.Url)
|
||||
}
|
||||
|
||||
if b.Heartbeat != nil {
|
||||
statusString := "down"
|
||||
|
||||
if b.Heartbeat.Status == 1 {
|
||||
statusString = "up"
|
||||
}
|
||||
title = fmt.Sprintf("[UptimeKuma] %v %v!", b.Monitor.Name, statusString)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if b.Heartbeat != nil {
|
||||
|
|
Loading…
Reference in New Issue