Merge pull request #5 from ayntgl/embeds

feat: implement sendable embeds
This commit is contained in:
Kedi 2022-01-17 16:54:56 +03:00 committed by GitHub
commit a1ea1288bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,14 +7,27 @@ import (
// Similar to message, but created for send message function. // Similar to message, but created for send message function.
type SendMessage struct { type SendMessage struct {
Content string `json:"content,omitempty"` Content string `json:"content"`
Attachments []string `json:"attachments,omitempty"`
Nonce string `json:"nonce,omitempty"` Nonce string `json:"nonce,omitempty"`
Attachments []string `json:"attachments,omitempty"`
Replies []Replies `json:"replies,omitempty"`
Embeds []SendableEmbed `json:"embeds,omitempty"`
DeleteAfter uint `json:"-"` DeleteAfter uint `json:"-"`
Replies []struct { }
Id string `json:"id,omitempty"`
type SendableEmbed struct {
Type string `json:"type"`
IconUrl string `json:"icon_url,omitempty"`
Url string `json:"url,omitempty"`
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Media string `json:"media,omitempty"`
Colour string `json:"colour,omitempty"`
}
type Replies struct {
Id string `json:"id"`
Mention bool `json:"mention"` Mention bool `json:"mention"`
} `json:"replies,omitempty"`
} }
// Set content. // Set content.
@ -43,10 +56,7 @@ func (sms *SendMessage) AddAttachment(attachment string) *SendMessage {
// Add a new reply. // Add a new reply.
func (sms *SendMessage) AddReply(id string, mention bool) *SendMessage { func (sms *SendMessage) AddReply(id string, mention bool) *SendMessage {
sms.Replies = append(sms.Replies, struct { sms.Replies = append(sms.Replies, Replies{
Id string "json:\"id,omitempty\""
Mention bool "json:\"mention\""
}{
Id: id, Id: id,
Mention: mention, Mention: mention,
}) })