-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.go
38 lines (32 loc) · 947 Bytes
/
options.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package telegram // import "github.com/robertgzr/joe-telegram-adapter"
import "go.uber.org/zap"
type Option func(*Config) error
// WithLogger allows configuring a custom zap.Logger for the adapter to use
func WithLogger(logger *zap.Logger) Option {
return func(conf *Config) error {
conf.Logger = logger
return nil
}
}
// WithUpdateTimeout allows configuring the update loop timeout (in seconds)
func WithUpdateTimeout(secs int) Option {
return func(conf *Config) error {
conf.UpdateTimeoutSec = secs
return nil
}
}
// WithUpdateResumeFrom allows setting the starting Update ID from which to
// process updates froms.
func WithUpdateResumeFrom(id int) Option {
return func(conf *Config) error {
conf.UpdateResumeFrom = id
return nil
}
}
// WithParseMode allows setting the message formatting used by Send
func WithParseMode(mode string) Option {
return func(conf *Config) error {
conf.ParseMode = mode
return nil
}
}