package main import "encoding/json" func UnmarshalWebhook(data []byte) (Webhook, error) { var r Webhook err := json.Unmarshal(data, &r) return r, err } func (r *Webhook) Marshal() ([]byte, error) { return json.Marshal(r) } type Webhook struct { Username string `json:"username,omitempty"` AvatarURL string `json:"avatar_url,omitempty"` TTS string `json:"tts,omitempty"` Content string `json:"content,omitempty"` Embeds []*Embed `json:"embeds,omitempty"` } type Embed struct { Author Author `json:"author,omitempty"` Title string `json:"title,omitempty"` URL string `json:"url,omitempty"` Description string `json:"description,omitempty"` Color int64 `json:"color,omitempty"` Fields []Field `json:"fields,omitempty"` Thumbnail Image `json:"thumbnail,omitempty"` Image Image `json:"image,omitempty"` Footer Footer `json:"footer,omitempty"` } type Author struct { Name string `json:"name"` URL string `json:"url"` IconURL string `json:"icon_url"` } type Field struct { Name string `json:"name"` Value string `json:"value"` Inline *bool `json:"inline,omitempty"` } type Footer struct { Text string `json:"text"` IconURL string `json:"icon_url"` } type Image struct { URL string `json:"url"` }