Documentation
¶
Index ¶
- func SendWebhook(webhookUrl string, webhookPayload Webhook) error
- type Author
- type Embed
- func (e *Embed) AddField(field Field)
- func (e *Embed) AddFields(fields []Field)
- func (e *Embed) SetAuthor(author Author)
- func (e *Embed) SetCustomTimestamp(timestamp string) error
- func (e *Embed) SetFooter(footer Footer)
- func (e *Embed) SetImage(image Image)
- func (e *Embed) SetThumbnail(thumbnail Thumbnail)
- func (e *Embed) SetTimestamp()
- type Field
- type Footer
- type Image
- type RGB
- type Thumbnail
- type Webhook
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SendWebhook ¶
SendWebhook sends the webhook payload to the specified Discord Webhook URL
Types ¶
type Author ¶
type Author struct { Name string `json:"name,omitempty"` URL string `json:"url,omitempty"` IconURL string `json:"icon_url,omitempty"` ProxyIconURL string `json:"proxy_icon_url,omitempty"` }
Author represents the author section of an embed
type Embed ¶
type Embed struct { Title string `json:"title,omitempty"` Description string `json:"description,omitempty"` URL string `json:"url,omitempty"` Color int `json:"color,omitempty"` Timestamp string `json:"timestamp,omitempty"` Image Image `json:"image,omitempty"` Thumbnail Thumbnail `json:"thumbnail,omitempty"` Author Author `json:"author,omitempty"` Fields []Field `json:"fields,omitempty"` }
Embed represents a rich embed object for Discord
func CreateEmbed ¶
CreateEmbed creates an embed with title, description, URL, and color (supports string, int, or RGB)
func (*Embed) SetCustomTimestamp ¶ added in v1.0.2
SetCustomTimestamp validates and sets an ISO8601 timestamp for the embed
func (*Embed) SetThumbnail ¶
SetThumbnail sets the thumbnail for the embed
func (*Embed) SetTimestamp ¶
func (e *Embed) SetTimestamp()
SetTimestamp sets current ISO8601 timestamp for the embed
type Field ¶
type Field struct { Name string `json:"name"` Value string `json:"value"` Inline bool `json:"inline,omitempty"` }
Field represents a key-value pair in the embed's fields section
type Image ¶
type Image struct { URL string `json:"url,omitempty"` ProxyURL string `json:"proxy_url,omitempty"` Height int `json:"height,omitempty"` Width int `json:"width,omitempty"` }
Image represents an image in an embed
type Thumbnail ¶
type Thumbnail struct { URL string `json:"url,omitempty"` ProxyURL string `json:"proxy_url,omitempty"` Height int `json:"height,omitempty"` Width int `json:"width,omitempty"` }
Thumbnail represents a thumbnail image in an embed
type Webhook ¶
type Webhook struct { Content string `json:"content,omitempty"` Username string `json:"username,omitempty"` AvatarURL string `json:"avatar_url,omitempty"` Embeds []Embed `json:"embeds,omitempty"` }
Webhook represents the structure for sending a message via Discord webhooks. It can include optional content, username, avatar URL, and an array of rich embed objects.
func CreateWebhook ¶
CreateWebhook creates a new Webhook with the specified content, username, and avatar URL
Directories
¶
Path | Synopsis |
---|---|
examples
|
|
example1
command
Example 1: Simplest webhook that sends a message to a Discord channel
|
Example 1: Simplest webhook that sends a message to a Discord channel |
example2
command
Example 2: More complicated webhook with author, thumbnail, image, footer and several fields.
|
Example 2: More complicated webhook with author, thumbnail, image, footer and several fields. |