mirror of
https://github.com/garethgeorge/backrest.git
synced 2026-09-10 10:15:35 +00:00
fix: make notification title optional on discord notifications
This commit is contained in:
@@ -20,7 +20,7 @@ func (h *Hook) doDiscord(cmd *v1.Hook_ActionDiscord, vars HookVars, output io.Wr
|
||||
}
|
||||
|
||||
request := Message{
|
||||
Content: "Backrest Notification\n" + payload, // leading newline looks better in discord.
|
||||
Content: payload, // leading newline looks better in discord.
|
||||
}
|
||||
|
||||
requestBytes, _ := json.Marshal(request)
|
||||
|
||||
@@ -116,7 +116,9 @@ func (v HookVars) renderTemplate(templ string) (string, error) {
|
||||
return buf.String(), nil
|
||||
}
|
||||
|
||||
var templateForSnapshotEnd = `Task: "{{ .Task }}" at {{ .FormatTime .CurTime }}
|
||||
var templateForSnapshotEnd = `
|
||||
Backrest Notification for Snapshot End
|
||||
Task: "{{ .Task }}" at {{ .FormatTime .CurTime }}
|
||||
Event: {{ .EventName .Event }}
|
||||
Repo: {{ .Repo.Id }}
|
||||
Plan: {{ .Plan.Id }}
|
||||
@@ -144,12 +146,16 @@ Backup Statistics:
|
||||
{{ end }}
|
||||
{{ end }}`
|
||||
|
||||
var templateForError = `Task: "{{ .Task }}" at {{ .FormatTime .CurTime }}
|
||||
var templateForError = `
|
||||
Backrest Notification for Error
|
||||
Task: "{{ .Task }}" at {{ .FormatTime .CurTime }}
|
||||
{{ if .Error -}}
|
||||
Error: {{ .Error }}
|
||||
{{ end }}`
|
||||
|
||||
var templateForSnapshotStart = `Task: "{{ .Task }}" at {{ .FormatTime .CurTime }}
|
||||
var templateForSnapshotStart = `
|
||||
Backrest Notification for Snapshot Start
|
||||
Task: "{{ .Task }}" at {{ .FormatTime .CurTime }}
|
||||
Event: {{ .EventName .Event }}
|
||||
Repo: {{ .Repo.Id }}
|
||||
Plan: {{ .Plan.Id }}
|
||||
|
||||
Reference in New Issue
Block a user