migration to chi

This commit is contained in:
2025-03-12 16:30:40 +03:00
parent ae81fbcce9
commit 45bb32e7a6
46 changed files with 1352 additions and 1323 deletions
+31
View File
@@ -0,0 +1,31 @@
package utils
import (
"bytes"
"encoding/json"
"net/http"
"time"
)
type Embed struct {
Title string `json:"title"`
Type string `json:"type"`
Description string `json:"description"`
URL string `json:"url"`
Timestamp time.Time `json:"timestamp"`
Color uint32 `json:"color"`
}
type WebhookContent struct {
Content string `json:"content"`
Embeds []Embed `json:"embeds"`
}
func ExecuteWebhook(url string, content WebhookContent) error {
body, err := json.Marshal(content)
if err != nil {
return err
}
_, err = http.Post(url, "application/json", bytes.NewReader(body))
return err
}