update ntfy channel special characters
This commit is contained in:
parent
b6634b7eaa
commit
ee642d5267
2 changed files with 5 additions and 2 deletions
3
main.go
3
main.go
|
|
@ -3,6 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
|
|
||||||
arg "github.com/alexflint/go-arg"
|
arg "github.com/alexflint/go-arg"
|
||||||
)
|
)
|
||||||
|
|
@ -29,7 +30,9 @@ func main() {
|
||||||
args.Pink, args.Yellow, args.Blue, args.Gray, args.Brown = true, true, true, true, true
|
args.Pink, args.Yellow, args.Blue, args.Gray, args.Brown = true, true, true, true, true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
replacer := strings.NewReplacer("ö", "oe", "ä", "ae", "ü", "ue", "ß", "ss")
|
||||||
NotifyChannel = fmt.Sprintf("%s-%d", args.Street, args.Home)
|
NotifyChannel = fmt.Sprintf("%s-%d", args.Street, args.Home)
|
||||||
|
NotifyChannel = replacer.Replace(NotifyChannel)
|
||||||
|
|
||||||
streetNumbers, err := GetStreetNumbers()
|
streetNumbers, err := GetStreetNumbers()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
4
ntfy.go
4
ntfy.go
|
|
@ -58,7 +58,7 @@ func SendNotification(message string) error {
|
||||||
|
|
||||||
func SendErr(err error) error {
|
func SendErr(err error) error {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
topic := fmt.Sprintf("https://ntfy.sh/awl-neuss-%s-err", NotifyChannel)
|
topic := "https://ntfy.sh/awl-neuss-err"
|
||||||
_, err = http.Post(topic, "text/plain", strings.NewReader(err.Error()))
|
_, err = http.Post(topic, "text/plain", strings.NewReader(NotifyChannel + "\n" + err.Error()))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue