@@ -28,14 +28,14 @@ func (config DocumentConfig) files() []RequestFile {
2828 // there always is a document file, so initialize the array with that.
2929 files := []RequestFile{{
3030 Name: " document" ,
31- File : config.File ,
31+ Data : config.File ,
3232 }}
3333
3434 // We'll only add a file if we have one.
3535 if config.Thumb != nil {
3636 files = append (files, RequestFile{
3737 Name: " thumb" ,
38- File : config.Thumb ,
38+ Data : config.Thumb ,
3939 })
4040 }
4141
@@ -58,7 +58,7 @@ Let's follow through creating a new media group with string and file uploads.
5858First, we start by creating some ` InputMediaPhoto ` .
5959
6060``` go
61- photo := tgbotapi.NewInputMediaPhoto (" tests/image.jpg" )
61+ photo := tgbotapi.NewInputMediaPhoto (tgbotapi. FilePath ( " tests/image.jpg" ) )
6262url := tgbotapi.NewInputMediaPhoto (tgbotapi.FileURL (" https://i.imgur.com/unQLJIb.jpg" ))
6363```
6464
@@ -85,24 +85,3 @@ are all changed into `attach://file-%d`. When collecting a list of files to
8585upload, it names them the same way. This creates a nearly transparent way of
8686handling multiple files in the background without the user having to consider
8787what's going on.
88-
89- ## Library Processing
90-
91- If at some point in the future new upload types are required, let's talk about
92- where the current types are used.
93-
94- Upload types are defined in ` configs.go ` . Where possible, type aliases are
95- preferred. Structs can be used when multiple fields are required.
96-
97- The main usage of the upload types happens in ` UploadFiles ` . It switches on each
98- file's type in order to determine how to upload it. Files that aren't uploaded
99- (file IDs, URLs) are converted back into strings and passed through as strings
100- into the correct field. Uploaded types are processed as needed (opening files,
101- etc.) and written into the form using a copy approach in a goroutine to reduce
102- memory usage.
103-
104- In addition to ` UploadFiles ` , there's more processing of upload types in the
105- ` prepareInputMediaParam ` and ` prepareInputMediaFile ` functions. These look at
106- the ` InputMedia ` types to determine which files are uploaded and which are
107- passed through as strings. They only need to be aware of which files need to be
108- replaced with ` attach:// ` fields.
0 commit comments