diff --git a/datepicker/options.go b/datepicker/options.go index 9e52a29..835250f 100644 --- a/datepicker/options.go +++ b/datepicker/options.go @@ -80,3 +80,17 @@ func WithPrefix(s string) Option { w.prefix = s } } + +// NoDeleteAfterSelect is a keyboard option that prevents the hide keyboard after select +func NoDeleteAfterSelect() Option { + return func(dp *DatePicker) { + dp.deleteOnSelect = false + } +} + +// NoDeleteAfterCancel is a keyboard option that prevents the hide keyboard after cancel +func NoDeleteAfterCancel() Option { + return func(dp *DatePicker) { + dp.deleteOnCancel = false + } +} diff --git a/slider/options.go b/slider/options.go index 78443ce..5996d9c 100644 --- a/slider/options.go +++ b/slider/options.go @@ -33,3 +33,17 @@ func WithPrefix(s string) Option { w.prefix = s } } + +// NoDeleteAfterSelect is a keyboard option that prevents the hide widget after select +func NoDeleteAfterSelect() Option { + return func(s *Slider) { + s.deleteOnSelect = false + } +} + +// NoDeleteAfterCancel is a keyboard option that prevents the hide widget after cancel +func NoDeleteAfterCancel() Option { + return func(s *Slider) { + s.deleteOnCancel = false + } +} diff --git a/slider/slider.go b/slider/slider.go index 1015188..99da7fd 100644 --- a/slider/slider.go +++ b/slider/slider.go @@ -46,9 +46,11 @@ type Slider struct { func New(slides []Slide, opts ...Option) *Slider { s := &Slider{ - prefix: bot.RandomString(16), - slides: slides, - onError: defaultOnError, + prefix: bot.RandomString(16), + slides: slides, + onError: defaultOnError, + deleteOnSelect: true, + deleteOnCancel: true, } for _, opt := range opts {