frigate/uptime-go/uptime/notify/notifier.go

29 lines
517 B
Go

package notify
import (
"fmt"
"strings"
)
type Notifier interface {
SendNotification(camera string, online bool)
}
func createMessage(camera string, online bool) string {
var msgTemplates = map[bool]string{
true: "%s camera is back online!",
false: "%s camera is offline!",
}
var cameraTitle string
for i, s := range strings.Split(camera, "_") {
if i > 0 {
cameraTitle += " "
}
cameraTitle += strings.ToUpper(string(s[0])) + s[1:]
}
return fmt.Sprintf(msgTemplates[online], cameraTitle)
}