-
Notifications
You must be signed in to change notification settings - Fork 35
/
webhook_message_create.go
28 lines (25 loc) · 1.15 KB
/
webhook_message_create.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package discord
import "github.com/disgoorg/snowflake/v2"
type WebhookMessageCreate struct {
Content string `json:"content,omitempty"`
Username string `json:"username,omitempty"`
AvatarURL string `json:"avatar_url,omitempty"`
TTS bool `json:"tts,omitempty"`
Embeds []Embed `json:"embeds,omitempty"`
Components []ContainerComponent `json:"components,omitempty"`
Attachments []AttachmentCreate `json:"attachments,omitempty"`
Files []*File `json:"-"`
AllowedMentions *AllowedMentions `json:"allowed_mentions,omitempty"`
Flags MessageFlags `json:"flags,omitempty"`
ThreadName string `json:"thread_name,omitempty"`
AppliedTags []snowflake.ID `json:"applied_tags,omitempty"`
Poll *PollCreate `json:"poll,omitempty"`
}
// ToBody returns the MessageCreate ready for body
func (m WebhookMessageCreate) ToBody() (any, error) {
if len(m.Files) > 0 {
m.Attachments = parseAttachments(m.Files)
return PayloadWithFiles(m, m.Files...)
}
return m, nil
}