mirror of
https://github.com/krau/SaveAny-Bot.git
synced 2026-06-28 02:31:34 +08:00
fix: update max upload part size to use uploader's maximum value and adjust document upload options
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
package tglimit
|
||||
|
||||
import (
|
||||
"github.com/gotd/td/telegram/uploader"
|
||||
)
|
||||
|
||||
const (
|
||||
MaxPartSize = 1024 * 1024
|
||||
MaxUploadPartSize = 512 * 1024
|
||||
MaxUploadPartSize = uploader.MaximumPartSize
|
||||
)
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user