Minor time conversion change within private API.

pull/92/head
Ian Byrd 7 years ago
parent a6b93fe7e9
commit 95901bcfc3
No known key found for this signature in database
GPG Key ID: 598F598CA3B8055F

@ -11,6 +11,7 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"strconv" "strconv"
"time"
) )
func sendCommand(method, token string, payload interface{}) ([]byte, error) { func sendCommand(method, token string, payload interface{}) ([]byte, error) {
@ -145,10 +146,10 @@ func getMe(token string) (User, error) {
return User{}, fmt.Errorf("telebot: %s", botInfo.Description) return User{}, fmt.Errorf("telebot: %s", botInfo.Description)
} }
func getUpdates(token string, offset, timeout int64) (upd []Update, err error) { func getUpdates(token string, offset, timeout time.Duration) (upd []Update, err error) {
params := map[string]string{ params := map[string]string{
"offset": strconv.FormatInt(offset, 10), "offset": strconv.Itoa(offset),
"timeout": strconv.FormatInt(timeout, 10), "timeout": strconv.Itoa(timeout / time.Second),
} }
updatesJSON, err := sendCommand("getUpdates", token, params) updatesJSON, err := sendCommand("getUpdates", token, params)
if err != nil { if err != nil {

@ -54,7 +54,7 @@ func (b *Bot) poll(
for { for {
updates, err := getUpdates(b.Token, updates, err := getUpdates(b.Token,
latestUpdate+1, latestUpdate+1,
int64(timeout/time.Second), timeout,
) )
if err != nil { if err != nil {

Loading…
Cancel
Save