migration to chi
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user