Revert "Debug"

This reverts commit 64802be8b9.
This commit is contained in:
Amin Vakil 2025-08-29 17:48:07 +03:30
parent e081a11b99
commit 5cc0865728
No known key found for this signature in database
GPG key ID: 1EFC1864E9D9E56B

View file

@ -6,7 +6,6 @@ import (
"fmt"
"net/http"
"strconv"
"io"
)
func init() {
@ -50,25 +49,10 @@ func (s *telegramNotifier) Notify(domain, provider, msg string, err error, previ
payload.Text = fmt.Sprintf("DNSControl successfully ran correction for %s[%s]:\n%s", domain, provider, msg)
}
// Debugging version
marshaledPayload, err := json.Marshal(payload)
if err != nil {
return fmt.Errorf("failed to marshal telegram payload: %w", err)
}
marshaledPayload, _ := json.Marshal(payload)
resp, posterr := http.Post(url, "application/json", bytes.NewBuffer(marshaledPayload))
if posterr != nil {
return posterr
}
defer resp.Body.Close()
// Check if Telegram returned an error (anything other than a 200 OK)
if resp.StatusCode != http.StatusOK {
body, _ := io.ReadAll(resp.Body) // You'll need to import "io"
return fmt.Errorf("telegram API error: %s", string(body))
}
return nil
_, posterr := http.Post(url, "application/json", bytes.NewBuffer(marshaledPayload))
return posterr
}
func (s *telegramNotifier) Done() {}