memos/plugin/telegram/api_get_updates.go
Athurg Gooth 845297ec03
refactor: change all Robot to Bot (#1767)
* Change all `Robot` to `Bot`

* Change all `r` of `Bot` to `b`

* Change `Robot` to `bot` in comments

* Fix typo

---------

Co-authored-by: Athurg Feng <athurg@gooth.org>
2023-05-29 19:49:05 +08:00

24 lines
413 B
Go

package telegram
import (
"context"
"net/url"
"strconv"
)
// GetUpdates make a getUpdates api request.
func (b *Bot) GetUpdates(ctx context.Context, offset int) ([]Update, error) {
formData := url.Values{
"timeout": {"60"},
"offset": {strconv.Itoa(offset)},
}
var result []Update
err := b.postForm(ctx, "/getUpdates", formData, &result)
if err != nil {
return nil, err
}
return result, nil
}