-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmessage-embeds.go
199 lines (168 loc) · 4.63 KB
/
message-embeds.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
package discog
import "github.com/bwmarrin/discordgo"
// Represents a message embed.
type MessageEmbed struct {
embed discordgo.MessageEmbed
}
// Represents a message embed auth
type MessageEmbedAuthor struct {
author discordgo.MessageEmbedAuthor
}
// Returns a MessageEmbed struct
func NewMessageEmbed() *MessageEmbed {
return &MessageEmbed{
embed: discordgo.MessageEmbed{},
}
}
// Sets type for the message embed
func (m *MessageEmbed) SetType(embedType discordgo.EmbedType) *MessageEmbed {
m.embed.Type = embedType
return m
}
// Sets Title for the message embed
func (m *MessageEmbed) SetTitle(title string) *MessageEmbed {
m.embed.Title = title
return m
}
// Sets Description for the message embed
func (m *MessageEmbed) SetDescription(description string) *MessageEmbed {
m.embed.Description = description
return m
}
// Sets Color for the message embed
func (m *MessageEmbed) SetColor(color int) *MessageEmbed {
m.embed.Color = color
return m
}
// Sets URL for the message embed
func (m *MessageEmbed) SetURL(url string) *MessageEmbed {
m.embed.URL = url
return m
}
// Sets Timestamp for the message embed
func (m *MessageEmbed) SetTimestamp(timestamp string) *MessageEmbed {
m.embed.Timestamp = timestamp
return m
}
// Sets Footer for the message embed
func (m *MessageEmbed) SetFooter(footer *discordgo.MessageEmbedFooter) *MessageEmbed {
m.embed.Footer = footer
return m
}
// Sets Image for the message embed
func (m *MessageEmbed) SetImage(image *discordgo.MessageEmbedImage) *MessageEmbed {
m.embed.Image = image
return m
}
// Sets Thumbnail for the message embed
func (m *MessageEmbed) SetThumbnail(thumbnail *discordgo.MessageEmbedThumbnail) *MessageEmbed {
m.embed.Thumbnail = thumbnail
return m
}
// Sets Video for the message embed
func (m *MessageEmbed) SetVideo(video *discordgo.MessageEmbedVideo) *MessageEmbed {
m.embed.Video = video
return m
}
// Sets Provider for the message embed
func (m *MessageEmbed) SetProvider(provider *discordgo.MessageEmbedProvider) *MessageEmbed {
m.embed.Provider = provider
return m
}
// Sets Author for the message embed
func (m *MessageEmbed) SetAuthor(author *discordgo.MessageEmbedAuthor) *MessageEmbed {
m.embed.Author = author
return m
}
// // Sets Fields for the message embed
func (m *MessageEmbed) SetFields(fields []*discordgo.MessageEmbedField) *MessageEmbed {
m.embed.Fields = fields
return m
}
// Returns the discordgo.MessageEmbed struct
func (m *MessageEmbed) GetComponent() *discordgo.MessageEmbed {
return &m.embed
}
// Returns the MessageEmbedAuthor struct
func NewEmbedAuthor(author string) *MessageEmbedAuthor {
return &MessageEmbedAuthor{
author: discordgo.MessageEmbedAuthor{
Name: author,
},
}
}
// Sets URL for the MessageEmbedAuthor
func (a *MessageEmbedAuthor) SetURL(url string) *MessageEmbedAuthor {
a.author.URL = url
return a
}
// Sets Icon for the MessageEmbedAuthor
func (a *MessageEmbedAuthor) SetIcon(icon string) *MessageEmbedAuthor {
a.author.IconURL = icon
return a
}
// Returns the discordgo.MessageEmbedAuthor
func (a *MessageEmbedAuthor) GetComponent() interface{} {
return a.author
}
// Returns the Footer for the MessageEmbed
func NewEmbedFooter(text string, iconUrl string) *discordgo.MessageEmbedFooter {
return &discordgo.MessageEmbedFooter{
Text: text,
IconURL: iconUrl,
}
}
// Returns the Image for the MessageEmbed
func NewEmbedImage(url string, width int, height int) *discordgo.MessageEmbedImage {
if width == 0 || height == 0 {
return &discordgo.MessageEmbedImage{
URL: url,
}
}
return &discordgo.MessageEmbedImage{
URL: url,
Width: width,
Height: height,
}
}
// Returns the Thumbnail for the MessageEmbed
func NewEmbedThumbnail(url string, width int, height int) *discordgo.MessageEmbedThumbnail {
if width == 0 || height == 0 {
return &discordgo.MessageEmbedThumbnail{
URL: url,
}
}
return &discordgo.MessageEmbedThumbnail{
URL: url,
Width: width,
Height: height,
}
}
// Returns the Video for the MessageEmbed
func NewEmbedVideo(url string, width int, height int) *discordgo.MessageEmbedVideo {
if width == 0 || height == 0 {
return &discordgo.MessageEmbedVideo{
URL: url,
}
}
return &discordgo.MessageEmbedVideo{
URL: url,
Width: width,
Height: height,
}
}
// Returns the Provider for the MessageEmbed
func NewEmbedProvider(url string, name string) *discordgo.MessageEmbedProvider {
return &discordgo.MessageEmbedProvider{
URL: url,
Name: name,
}
}
// Returns the Field for the MessageEmbed
func NewEmbedFields(name string, value string, isInline bool) *discordgo.MessageEmbedField {
return &discordgo.MessageEmbedField{
Name: name,
Value: value,
Inline: isInline,
}
}