mirror of
https://github.com/krau/SaveAny-Bot.git
synced 2026-08-25 02:00:59 +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
|
package tglimit
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gotd/td/telegram/uploader"
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
MaxPartSize = 1024 * 1024
|
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)
|
caption := styling.Plain(filename)
|
||||||
docb := message.UploadedDocument(file, caption).
|
docb := message.UploadedDocument(file, caption).
|
||||||
Filename(filename).
|
Filename(filename).
|
||||||
ForceFile(true).
|
ForceFile(false).
|
||||||
MIME(mtype.String())
|
MIME(mtype.String())
|
||||||
|
|
||||||
var mediaOpt message.MediaOption = docb
|
|
||||||
sender := tctx.Sender
|
sender := tctx.Sender
|
||||||
_, err = sender.WithUploader(upler).To(peer).Media(ctx, mediaOpt)
|
_, err = sender.WithUploader(upler).To(peer).Media(ctx, docb)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user