Documentation
¶
Overview ¶
Package updatepoller provides a long-polling mechanism for receiving updates from the Telegram Bot API.
Index ¶
- type OffsetStore
- type OptOptionsSetter
- func WithAllowedUpdates(opt []string) OptOptionsSetter
- func WithBufferSize(opt int) OptOptionsSetter
- func WithLimit(opt int) OptOptionsSetter
- func WithLogger(opt logger.Logger) OptOptionsSetter
- func WithOffsetStore(opt OffsetStore) OptOptionsSetter
- func WithPollingInterval(opt time.Duration) OptOptionsSetter
- func WithRequestTimeout(opt time.Duration) OptOptionsSetter
- func WithTimeout(opt time.Duration) OptOptionsSetter
- type Options
- type Poller
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OffsetStore ¶
type OffsetStore interface {
// Load loads the offset from the store.
Load(ctx context.Context) (int, error)
// Save saves the offset to the store.
Save(ctx context.Context, offset int) error
}
OffsetStore is an interface for storing and loading the update offset.
type OptOptionsSetter ¶
type OptOptionsSetter func(o *Options)
func WithAllowedUpdates ¶
func WithAllowedUpdates(opt []string) OptOptionsSetter
allowedUpdates restricts the Telegram update types returned by polling.
func WithBufferSize ¶
func WithBufferSize(opt int) OptOptionsSetter
bufferSize is the capacity of the update channel.
func WithLimit ¶
func WithLimit(opt int) OptOptionsSetter
limit is the maximum number of updates to fetch per request.
func WithOffsetStore ¶
func WithOffsetStore(opt OffsetStore) OptOptionsSetter
offsetStore is the store to use for storing the update offset.
func WithPollingInterval ¶
func WithPollingInterval(opt time.Duration) OptOptionsSetter
pollingInterval is the interval between polling requests.
func WithRequestTimeout ¶
func WithRequestTimeout(opt time.Duration) OptOptionsSetter
requestTimeout is the per-GetUpdates transport deadline. Zero disables it.
func WithTimeout ¶
func WithTimeout(opt time.Duration) OptOptionsSetter
timeout is the long-polling timeout sent to Telegram.
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options is the options for the Poller.
func NewOptions ¶
func NewOptions( client client.ClientWithResponsesInterface, options ...OptOptionsSetter, ) Options
type Poller ¶
type Poller struct {
// contains filtered or unexported fields
}
Poller polls the Telegram API for updates.
func (*Poller) UpdateChan ¶
UpdateChan returns the updates channel.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package offsetstore provides implementations for storing the update offset.
|
Package offsetstore provides implementations for storing the update offset. |