fix: update max upload part size to use uploader's maximum value and adjust document upload options

This commit is contained in:
krau
2025-07-28 14:58:01 +08:00
parent 03907f2d32
commit 6423fb25a7
2 changed files with 7 additions and 4 deletions

View File

@@ -1,6 +1,10 @@
package tglimit
import (
"github.com/gotd/td/telegram/uploader"
)
const (
MaxPartSize = 1024 * 1024
MaxUploadPartSize = 512 * 1024
MaxUploadPartSize = uploader.MaximumPartSize
)

View File

@@ -108,12 +108,11 @@ func (t *Telegram) Save(ctx context.Context, r io.Reader, storagePath string) er
caption := styling.Plain(filename)
docb := message.UploadedDocument(file, caption).
Filename(filename).
ForceFile(true).
ForceFile(false).
MIME(mtype.String())
var mediaOpt message.MediaOption = docb
sender := tctx.Sender
_, err = sender.WithUploader(upler).To(peer).Media(ctx, mediaOpt)
_, err = sender.WithUploader(upler).To(peer).Media(ctx, docb)
return err
}