package main import ( "bytes" "encoding/json" "log" "net/http" ) const discordWebhookURL = "YOUR_DISCORD_WEBHOOK_URL" // Replace with your Discord webhook URL type DiscordWebhookPayload struct { Content string `json:"content"` } func sendDiscordNotification(content string) { payload := DiscordWebhookPayload{Content: content} payloadBytes, err := json.Marshal(payload) if err != nil { log.Printf("Error marshalling Discord webhook payload: %v", err) return } resp, err := http.Post(discordWebhookURL, "application/json", bytes.NewBuffer(payloadBytes)) if err != nil { log.Printf("Error sending Discord webhook: %v", err) return } defer resp.Body.Close() if resp.StatusCode != http.StatusNoContent { log.Printf("Unexpected status code from Discord webhook: %d", resp.StatusCode) } }