Files
SaveAny-Bot/pkg/tfile/opts.go
Copilot 3e20dc2c5f feat: add custom parameter support to /ytdlp command (#185), close #184
* Initial plan

* Implement parameter support for /ytdlp command

Co-authored-by: krau <71133316+krau@users.noreply.github.com>

* Add comprehensive tests for ytdlp parameter parsing

Co-authored-by: krau <71133316+krau@users.noreply.github.com>

* Improve flag parsing logic and clarify argument order

Co-authored-by: krau <71133316+krau@users.noreply.github.com>

* Preserve critical defaults and improve comments

Co-authored-by: krau <71133316+krau@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: krau <71133316+krau@users.noreply.github.com>
2026-01-19 13:10:21 +08:00

40 lines
598 B
Go

package tfile
import "github.com/gotd/td/tg"
type TGFileOption func(*tgFile)
func WithMessage(msg *tg.Message) TGFileOption {
return func(f *tgFile) {
f.message = msg
}
}
func WithName(name string) TGFileOption {
return func(f *tgFile) {
f.name = name
}
}
func WithNameIfEmpty(name string) TGFileOption {
return func(f *tgFile) {
if f.name == "" {
f.name = name
}
}
}
func WithSize(size int64) TGFileOption {
return func(f *tgFile) {
f.size = size
}
}
func WithSizeIfZero(size int64) TGFileOption {
return func(f *tgFile) {
if f.size == 0 {
f.size = size
}
}
}