@@ -77,6 +77,7 @@ func NewEmbed() *Embed {
77
77
}
78
78
}
79
79
80
+ // SetTitle - Set the Embed title
80
81
func (e * Embed ) SetTitle (title string ) * Embed {
81
82
if len (title ) > titleLimit {
82
83
title = title [:titleLimit - 4 ] + " ..."
@@ -86,10 +87,13 @@ func (e *Embed) SetTitle(title string) *Embed {
86
87
return e
87
88
}
88
89
90
+ // GetTitle - Get the Embed title
91
+ // Deprecated: Access the struct field directly
89
92
func (e * Embed ) GetTitle () string {
90
93
return e .Title
91
94
}
92
95
96
+ // SetDescription - Set the Embed description
93
97
func (e * Embed ) SetDescription (description string ) * Embed {
94
98
if len (description ) > descriptionLimit {
95
99
description = description [:descriptionLimit - 4 ] + " ..."
@@ -99,10 +103,13 @@ func (e *Embed) SetDescription(description string) *Embed {
99
103
return e
100
104
}
101
105
106
+ // GetDescription - Get the Embed description
107
+ // Deprecated: Access the struct field directly
102
108
func (e * Embed ) GetDescription () string {
103
109
return e .Description
104
110
}
105
111
112
+ // SetURL - Set the Embed URL
106
113
func (e * Embed ) SetURL (u string ) * Embed {
107
114
// We only check for an error to validate if it's a properly formed URL
108
115
if _ , err := url .Parse (u ); err != nil {
@@ -113,76 +120,98 @@ func (e *Embed) SetURL(u string) *Embed {
113
120
return e
114
121
}
115
122
123
+ // GetURL - Get the Embed URL
124
+ // Deprecated: Access the struct field directly
116
125
func (e * Embed ) GetURL () string {
117
126
return e .URL
118
127
}
119
128
129
+ // SetTimestamp - Set the Embed timestamp
120
130
func (e * Embed ) SetTimestamp (ts time.Time ) * Embed {
121
131
e .Timestamp = ts .UTC ().Format (time .RFC3339 )
122
132
123
133
return e
124
134
}
125
135
136
+ // GetTimestamp - Get the Embed timestamp
137
+ // Deprecated: Access the struct field directly
126
138
func (e * Embed ) GetTimestamp () (time.Time , error ) {
127
139
return time .Parse (time .RFC3339 , e .Timestamp )
128
140
}
129
141
142
+ // SetColor - Set the Embed color
130
143
func (e * Embed ) SetColor (c int64 ) * Embed {
131
144
e .Color = c
132
145
133
146
return e
134
147
}
135
148
149
+ // GetColor - Get the Embed color
150
+ // Deprecated: Access the struct field directly
136
151
func (e * Embed ) GetColor () int64 {
137
152
return e .Color
138
153
}
139
154
155
+ // SetFooter - Set the Footer
140
156
func (e * Embed ) SetFooter (text string , iconURL string ) * Embed {
141
157
e .Footer = newFooter ().SetText (text ).SetIconURL (iconURL )
142
158
143
159
return e
144
160
}
145
161
162
+ // GetFooter - Get the Embed footer
163
+ // Deprecated: Access the struct field directly
146
164
func (e * Embed ) GetFooter () * Footer {
147
165
return e .Footer
148
166
}
149
167
168
+ // SetImage - Set the Image
150
169
func (e * Embed ) SetImage (imageURL string ) * Embed {
151
170
e .Image = newImage ().SetURL (imageURL )
152
171
153
172
return e
154
173
}
155
174
175
+ // GetImage - Get the Embed image
176
+ // Deprecated: Access the struct field directly
156
177
func (e * Embed ) GetImage () * Image {
157
178
return e .Image
158
179
}
159
180
181
+ // SetThumbnail - Set the Thumbnail
160
182
func (e * Embed ) SetThumbnail (thumbnailURL string ) * Embed {
161
183
e .Thumbnail = newThumbnail ().SetURL (thumbnailURL )
162
184
163
185
return e
164
186
}
165
187
188
+ // GetThumbnail - Get the Embed thumbnail
189
+ // Deprecated: Access the struct field directly
166
190
func (e * Embed ) GetThumbnail () string {
167
191
return e .Thumbnail .URL
168
192
}
169
193
194
+ // SetAuthor - Set the Author
170
195
func (e * Embed ) SetAuthor (name , url string , iconURL * string ) * Embed {
171
196
e .Author = newAuthor ().SetName (name ).SetURL (url ).SetIconURL (iconURL )
172
197
173
198
return e
174
199
}
175
200
201
+ // GetAuthor - Get the Embed author
202
+ // Deprecated: Access the struct field directly
176
203
func (e * Embed ) GetAuthor () * Author {
177
204
return e .Author
178
205
}
179
206
207
+ // AddField - Add a singular Field
180
208
func (e * Embed ) AddField (name , value string , inline bool ) * Embed {
181
- e .Fields = append (e .Fields , newField ().SetName (name ).SetValue (value ).SetInline (inline ))
209
+ e .Fields = append (e .Fields , NewField ().SetName (name ).SetValue (value ).SetInline (inline ))
182
210
183
211
return e
184
212
}
185
213
214
+ // AddFields - Add multiple fields; must create the Field objects first
186
215
func (e * Embed ) AddFields (fields ... * Field ) * Embed {
187
216
if len (fields ) == 0 {
188
217
return e
@@ -193,6 +222,8 @@ func (e *Embed) AddFields(fields ...*Field) *Embed {
193
222
return e
194
223
}
195
224
225
+ // GetFields - Get the Embed fields
226
+ // Deprecated: Access the struct field directly
196
227
func (e * Embed ) GetFields () []* Field {
197
228
return e .Fields
198
229
}
@@ -203,6 +234,7 @@ func newFooter() *Footer {
203
234
return & Footer {}
204
235
}
205
236
237
+ // SetText - set the Footer text
206
238
func (f * Footer ) SetText (text string ) * Footer {
207
239
if len (text ) > footerTextLimit {
208
240
text = text [:footerTextLimit - 4 ] + " ..."
@@ -212,10 +244,13 @@ func (f *Footer) SetText(text string) *Footer {
212
244
return f
213
245
}
214
246
247
+ // GetText - Get the Footer text
248
+ // Deprecated: Access the struct field directly
215
249
func (f * Footer ) GetText () string {
216
250
return f .Text
217
251
}
218
252
253
+ // SetIconURL - set the Footer IconURL
219
254
func (f * Footer ) SetIconURL (iconURL string ) * Footer {
220
255
if _ , err := url .Parse (iconURL ); err != nil {
221
256
return f
@@ -225,6 +260,8 @@ func (f *Footer) SetIconURL(iconURL string) *Footer {
225
260
return f
226
261
}
227
262
263
+ // GetIconURL - Get the Footer icon URL
264
+ // Deprecated: Access the struct field directly
228
265
func (f * Footer ) GetIconURL () string {
229
266
return f .IconURL
230
267
}
@@ -235,6 +272,7 @@ func newImage() *Image {
235
272
return & Image {}
236
273
}
237
274
275
+ // SetURL - set the Image URL
238
276
func (i * Image ) SetURL (u string ) * Image {
239
277
if _ , err := url .Parse (u ); err != nil {
240
278
return i
@@ -244,6 +282,8 @@ func (i *Image) SetURL(u string) *Image {
244
282
return i
245
283
}
246
284
285
+ // GetURL - Get the Image URL
286
+ // Deprecated: Access the struct field directly
247
287
func (i * Image ) GetURL () string {
248
288
return i .URL
249
289
}
@@ -254,6 +294,7 @@ func newThumbnail() *Thumbnail {
254
294
return & Thumbnail {}
255
295
}
256
296
297
+ // SetURL - set the Thumbnail URL
257
298
func (t * Thumbnail ) SetURL (u string ) * Thumbnail {
258
299
if _ , err := url .Parse (u ); err != nil {
259
300
return t
@@ -263,6 +304,8 @@ func (t *Thumbnail) SetURL(u string) *Thumbnail {
263
304
return t
264
305
}
265
306
307
+ // GetURL - Get the Thumbnail URL
308
+ // Deprecated: Access the struct field directly
266
309
func (t * Thumbnail ) GetURL () string {
267
310
return t .URL
268
311
}
@@ -273,6 +316,7 @@ func newAuthor() *Author {
273
316
return & Author {}
274
317
}
275
318
319
+ // SetName - set the Author Name
276
320
func (a * Author ) SetName (name string ) * Author {
277
321
if len (name ) > authorNameLimit {
278
322
name = name [:authorNameLimit - 4 ] + " ..."
@@ -282,10 +326,13 @@ func (a *Author) SetName(name string) *Author {
282
326
return a
283
327
}
284
328
329
+ // GetName - Get the Author name
330
+ // Deprecated: Access the struct field directly
285
331
func (a * Author ) GetName () string {
286
332
return a .Name
287
333
}
288
334
335
+ // SetURL - set the Author URL
289
336
func (a * Author ) SetURL (u string ) * Author {
290
337
if _ , err := url .Parse (u ); err != nil {
291
338
return a
@@ -295,10 +342,13 @@ func (a *Author) SetURL(u string) *Author {
295
342
return a
296
343
}
297
344
345
+ // GetURL - Get the Author URL
346
+ // Deprecated: Access the struct field directly
298
347
func (a * Author ) GetURL () string {
299
348
return a .URL
300
349
}
301
350
351
+ // SetIconURL - set the Author IconURL
302
352
func (a * Author ) SetIconURL (u * string ) * Author {
303
353
if _ , err := url .Parse (* u ); err != nil {
304
354
return a
@@ -308,12 +358,12 @@ func (a *Author) SetIconURL(u *string) *Author {
308
358
return a
309
359
}
310
360
311
- /* EMBED FIELD */
312
-
313
- func newField () * Field {
361
+ // NewField - Create a new base Field to chain against
362
+ func NewField () * Field {
314
363
return & Field {}
315
364
}
316
365
366
+ // SetName - set the Field Name
317
367
func (f * Field ) SetName (name string ) * Field {
318
368
if len (name ) > fieldNameLimit {
319
369
name = name [:fieldNameLimit - 4 ] + " ..."
@@ -323,10 +373,13 @@ func (f *Field) SetName(name string) *Field {
323
373
return f
324
374
}
325
375
376
+ // GetName - Get the Field name
377
+ // Deprecated: Access the struct field directly
326
378
func (f * Field ) GetName () string {
327
379
return f .Name
328
380
}
329
381
382
+ // SetValue - set the Field Value
330
383
func (f * Field ) SetValue (value string ) * Field {
331
384
if len (value ) > fieldValueLimit {
332
385
value = value [:fieldValueLimit - 4 ] + " ..."
@@ -336,16 +389,20 @@ func (f *Field) SetValue(value string) *Field {
336
389
return f
337
390
}
338
391
392
+ // GetValue - Get the Field value
393
+ // Deprecated: Access the struct field directly
339
394
func (f * Field ) GetValue () string {
340
395
return f .Value
341
396
}
342
397
398
+ // SetInline - set the Field Inline
343
399
func (f * Field ) SetInline (inline bool ) * Field {
344
400
f .Inline = inline
345
401
346
402
return f
347
403
}
348
404
405
+ // IsInline - Helper function for testing is inline
349
406
func (f * Field ) IsInline () bool {
350
407
return f .Inline
351
408
}
0 commit comments