Documentation
¶
Index ¶
Constants ¶
View Source
const ( MaxEmbedsPerMessage = 10 MaxFieldsPerEmbed = 25 MaxTotalTextCharacters = 6000 MaxTitleCharacters = 256 MaxDescriptionCharacters = 4096 MaxAuthorNameCharacters = 256 MaxFieldNameCharacters = 256 MaxFieldValueCharacters = 1024 MaxColorValue = 16777215 )
Variables ¶
This section is empty.
Functions ¶
func MarshalEmbeds ¶
func ValidateEmbeds ¶
Types ¶
type Embed ¶
type Embed struct {
Title string `json:"title,omitempty" example:"GoChat 1.0"` // Embed title.
Type string `json:"type,omitempty" example:"rich" enums:"rich,image,video,gifv,article,link"` // Embed type.
Description string `json:"description,omitempty" example:"Embed support is live."` // Main embed description.
URL string `json:"url,omitempty" example:"https://example.com/release"` // Canonical URL opened when the embed title is clicked.
Timestamp *time.Time `json:"timestamp,omitempty" swaggertype:"string" format:"date-time"` // Optional ISO timestamp shown by the client.
Color *int `json:"color,omitempty" example:"65280"` // Decimal RGB color value.
Image *EmbedMedia `json:"image,omitempty"` // Full-size image block.
Thumbnail *EmbedMedia `json:"thumbnail,omitempty"` // Thumbnail image block.
Video *EmbedMedia `json:"video,omitempty"` // Embedded video metadata.
Provider *EmbedProvider `json:"provider,omitempty"` // Content provider metadata.
Author *EmbedAuthor `json:"author,omitempty"` // Embed author metadata.
Fields []EmbedField `json:"fields,omitempty"` // Up to 25 structured fields.
}
Embed is a Discord-like message embed object.
func MergeEmbeds ¶
func ParseEmbeds ¶
type EmbedAuthor ¶
type EmbedAuthor struct {
Name string `json:"name,omitempty" example:"The PrimeTime"` // Author display name.
URL string `json:"url,omitempty" example:"https://www.youtube.com/channel/UCUyeluBRhGPCW4rPe_UvBZQ"` // Author URL.
IconURL string `json:"icon_url,omitempty" example:"https://example.com/author.png"` // Author icon URL.
ProxyIconURL string `json:"proxy_icon_url,omitempty" example:"https://cdn.example.com/author.png"` // Optional proxied author icon URL.
}
EmbedAuthor identifies the embed author or channel.
type EmbedField ¶
type EmbedField struct {
Name string `json:"name" example:"Status"` // Field label.
Value string `json:"value" example:"Stable"` // Field value.
Inline *bool `json:"inline,omitempty" example:"true"` // Whether the field should be rendered inline.
}
EmbedField is a structured name/value row within an embed.
type EmbedFooter ¶
type EmbedFooter struct {
}
EmbedFooter is the footer block shown at the bottom of an embed.
type EmbedMedia ¶
type EmbedMedia struct {
URL string `json:"url,omitempty" example:"https://example.com/preview.png"` // Media URL.
ProxyURL string `json:"proxy_url,omitempty" example:"https://cdn.example.com/preview.png"` // Optional proxied media URL.
Height *int64 `json:"height,omitempty" example:"720"` // Media height in pixels.
Width *int64 `json:"width,omitempty" example:"1280"` // Media width in pixels.
ContentType string `json:"content_type,omitempty" example:"image/png"` // Media MIME type when known.
Placeholder string `json:"placeholder,omitempty" example:"IPgNDIQbRUaQiJcwuYlwmyQ5Bg=="` // Encoded placeholder used by some generated embeds.
PlaceholderVersion *int `json:"placeholder_version,omitempty" example:"1"` // Placeholder format version.
Flags *int `json:"flags,omitempty" example:"0"` // Media-specific flags from the source provider.
}
EmbedMedia describes image, thumbnail, or video media attached to an embed.
type EmbedProvider ¶
type EmbedProvider struct {
Name string `json:"name,omitempty" example:"YouTube"` // Provider name.
URL string `json:"url,omitempty" example:"https://www.youtube.com"` // Provider URL.
}
EmbedProvider identifies the site or service that produced an embed.
Click to show internal directories.
Click to hide internal directories.