From a2d28e604d6dc163ec4eb489d7f4d3dfe99f2846 Mon Sep 17 00:00:00 2001 From: Ian Byrd Date: Tue, 12 Dec 2017 00:27:09 +0200 Subject: [PATCH] Minor API changes. --- callbacks.go | 2 ++ options.go | 2 ++ poller.go | 6 +++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/callbacks.go b/callbacks.go index b92349c..046ccba 100644 --- a/callbacks.go +++ b/callbacks.go @@ -66,6 +66,8 @@ type InlineButton struct { URL string `json:"url,omitempty"` Data string `json:"callback_data,omitempty"` InlineQuery string `json:"switch_inline_query,omitempty"` + + Action func(*Callback) } // CallbackUnique returns InlineButto.Unique. diff --git a/options.go b/options.go index c228320..19c2961 100644 --- a/options.go +++ b/options.go @@ -128,6 +128,8 @@ type ReplyButton struct { Contact bool `json:"request_contact,omitempty"` Location bool `json:"request_location,omitempty"` + + Action func(*Callback) } // InlineKeyboardMarkup represents an inline keyboard that appears diff --git a/poller.go b/poller.go index 4e5d8e5..72a371f 100644 --- a/poller.go +++ b/poller.go @@ -6,6 +6,10 @@ import ( "github.com/pkg/errors" ) +var ( + ErrCouldNotUpdate = errors.New("getUpdates() failed") +) + // Poller is a provider of Updates. // // All pollers must implement Poll(), which accepts bot @@ -90,7 +94,7 @@ func (p *LongPoller) Poll(b *Bot, dest chan Update, stop chan struct{}) { updates, err := b.getUpdates(p.LastUpdateID+1, p.Timeout) if err != nil { - b.debug(errors.Wrap(err, "getUpdates() failed")) + b.debug(ErrCouldNotUpdate) continue }