Documentation
¶
Index ¶
Constants ¶
const ( AllowedMentionEveryone = "everyone" AllowedMentionRoles = "roles" AllowedMentionUsers = "users" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Embed ¶
type Embed struct {
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
URL string `json:"url,omitempty"`
Timestamp string `json:"timestamp,omitempty"`
Color int `json:"color,omitempty"`
Image EmbedImage `json:"image,omitempty"`
Thumbnail EmbedImage `json:"thumbnail,omitempty"`
Author EmbedAuthor `json:"author,omitempty"`
Fields []EmbedField `json:"fields,omitempty"`
}
Embed represents a Discord embed object that can be used as part of a Message. See more about specific fields at https://discord.com/developers/docs/resources/channel#embed-object-embed-structure
type EmbedAuthor ¶
type EmbedAuthor struct {
Name string `json:"name,omitempty"`
URL string `json:"url,omitempty"`
IconURL string `json:"icon_url,omitempty"`
}
EmbedAuthor represent a Discord embed author object that can be as part of a Message. See more about specific fields at https://discord.com/developers/docs/resources/channel#embed-object-embed-author-structure
type EmbedField ¶
type EmbedField struct {
Name string `json:"name"`
Value string `json:"value"`
Inline bool `json:"inline,omitempty"`
}
EmbedField represents a Discord embed field object that can be used as part of a Message. See more about specific fields at https://discord.com/developers/docs/resources/channel#embed-object-embed-field-structure
type EmbedFooter ¶
type EmbedFooter struct {
}
EmbedFooter represents an embed footer object that can be used as part of a message. See more about specific fields at https://discord.com/developers/docs/resources/channel#embed-object-embed-footer-structure
type EmbedImage ¶
type EmbedImage struct {
URL string `json:"url,omitempty"`
}
EmbedImage represents an embed image object that can be used as part of a Message. See more about specific fields at https://discord.com/developers/docs/resources/channel#embed-object-embed-image-structure
type Message ¶
type Message struct {
Content string `json:"content,omitempty"`
Username string `json:"username,omitempty"`
AvatarURL string `json:"avatar_url,omitempty"`
TTS bool `json:"tts,omitempty"`
Files []File `json:"-"`
Embeds []Embed `json:"embeds,omitempty"`
AllowedMentions struct {
Parse []string `json:"parse,omitempty"`
Roles []string `json:"roles,omitempty"`
Users []string `json:"users,omitempty"`
RepliedUser bool `json:"replied_user,omitempty"`
} `json:"allowed_mentions,omitempty"`
}
Message represents a message to be sent using a webhook. See information about specific fields at https://discord.com/developers/docs/resources/webhook#execute-webhook-jsonform-params. It also includes the allowed_mentions attribute, which represents a Discord Allowed Mentions object. See information about specific fields at https://discord.com/developers/docs/resources/channel#allowed-mentions-object.
func (*Message) AddFile ¶
AddFile takes a filename, reads the contents of that file and adds that file to the message
func (*Message) Send ¶
Send sends the Message object to the specified endpoint. The `wait` parameter will specify that the Discord API should wait for confirmation of the message being sent before a HTTP response is sent, which will contain the created message body. Returns the raw HTTP response, and an error. In the event that an error is returned after a request has been made to the Discord API, the response is also returned. Else, nil is returned.
type RatelimitError ¶
RatelimitError is used when a request was sent to the Discord API that caused a 429 error response to be returned.
func (*RatelimitError) Error ¶
func (s *RatelimitError) Error() string
Error returns a string representation of the error
type RequestError ¶
RequestError is used when a request was sent to the Discord API that caused a non-2xx and a non-429 response to be returned.
func (*RequestError) Error ¶
func (s *RequestError) Error() string
Error returns a string representation of the error
type ValidationError ¶
type ValidationError struct {
// contains filtered or unexported fields
}
ValidationError is used when a Message object fails local validation
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
Error returns a string representation of the error