/
embed.go
69 lines (60 loc) · 2.09 KB
/
embed.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package discord
import "time"
// EmbedType is the type of Embed
type EmbedType string
// Constants for EmbedType
const (
EmbedTypeRich EmbedType = "rich"
EmbedTypeImage EmbedType = "image"
EmbedTypeVideo EmbedType = "video"
EmbedTypeGifV EmbedType = "rich"
EmbedTypeArticle EmbedType = "article"
EmbedTypeLink EmbedType = "link"
)
// Embed allows you to send embeds to discord
type Embed struct {
Title string `json:"title,omitempty"`
Type EmbedType `json:"type,omitempty"`
Description string `json:"description,omitempty"`
URL string `json:"url,omitempty"`
Timestamp *time.Time `json:"timestamp,omitempty"`
Color int `json:"color,omitempty"`
Footer *EmbedFooter `json:"footer,omitempty"`
Image *EmbedResource `json:"image,omitempty"`
Thumbnail *EmbedResource `json:"thumbnail,omitempty"`
Video *EmbedResource `json:"video,omitempty"`
Provider *EmbedProvider `json:"provider,omitempty"`
Author *EmbedAuthor `json:"author,omitempty"`
Fields []EmbedField `json:"fields,omitempty"`
}
// The EmbedResource of an Embed.Image/Embed.Thumbnail/Embed.Video
type EmbedResource struct {
URL string `json:"url,omitempty"`
ProxyURL string `json:"proxy_url,omitempty"`
Height int `json:"height,omitempty"`
Width int `json:"width,omitempty"`
}
// The EmbedProvider of an Embed
type EmbedProvider struct {
Name string `json:"name,omitempty"`
URL string `json:"url,omitempty"`
}
// The EmbedAuthor of an Embed
type EmbedAuthor struct {
Name string `json:"name,omitempty"`
URL string `json:"url,omitempty"`
IconURL string `json:"icon_url,omitempty"`
ProxyIconURL string `json:"proxy_icon_url,omitempty"`
}
// The EmbedFooter of an Embed
type EmbedFooter struct {
Text string `json:"text"`
IconURL string `json:"icon_url,omitempty"`
ProxyIconURL string `json:"proxy_icon_url,omitempty"`
}
// EmbedField (s) of an Embed
type EmbedField struct {
Name string `json:"name"`
Value string `json:"value"`
Inline *bool `json:"inline,omitempty"`
}