File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,8 @@ type SendMessageData struct {
102102 // Embed is embedded rich content.
103103 Embed * discord.Embed `json:"embed,omitempty"`
104104
105+ // Files is the list of file attachments to be uploaded. To reference a file
106+ // in an embed, use (sendpart.File).AttachmentURI().
105107 Files []sendpart.File `json:"-"`
106108
107109 // AllowedMentions are the allowed mentions for a message.
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package sendpart
33import (
44 "io"
55 "mime/multipart"
6+ "net/url"
67 "strconv"
78
89 "github.com/diamondburned/arikawa/v2/utils/httputil"
@@ -16,6 +17,16 @@ type File struct {
1617 Reader io.Reader
1718}
1819
20+ // AttachmentURI returns the file encoded using the attachment URI required for
21+ // embedding an attachment image.
22+ func (f File ) AttachmentURI () string {
23+ u := url.URL {
24+ Scheme : "attachment" ,
25+ Path : f .Name ,
26+ }
27+ return u .String ()
28+ }
29+
1930// DataMultipartWriter is a MultipartWriter that also contains data that's
2031// JSON-marshalable.
2132type DataMultipartWriter interface {
You can’t perform that action at this time.
0 commit comments