notifybot.go 384 B

1234567891011121314151617181920
  1. package notifybot
  2. import (
  3. "net/http"
  4. "net/url"
  5. "github.com/spf13/viper"
  6. )
  7. func NotifyMsg(msg string) {
  8. go func() {
  9. notify_token := viper.GetString("notify_token")
  10. if notify_token == "" {
  11. notify_token = "default"
  12. }
  13. reqUrl := "https://notifybot.daxia.dev:8443/notify?token=" + url.QueryEscape(notify_token) + "&msg=" + url.QueryEscape(msg)
  14. http.Get(reqUrl)
  15. }()
  16. }