all repos — telegram-bot-api @ 4f996f7f277d290fb753a72c125cd4c8186634e8

Golang bindings for the Telegram Bot API

Add NewInlineQueryResultPhotoWithThumb for #54.
Syfaro syfaro@foxpaw.in
Tue, 26 Jul 2016 13:44:48 -0500
commit

4f996f7f277d290fb753a72c125cd4c8186634e8

parent

1daed40422d154dcd781d9fa6b5ca1add15635bf

3 files changed, 22 insertions(+), 1 deletions(-)

jump to
M bot.gobot.go

@@ -396,7 +396,7 @@ // SetWebhook sets a webhook.

// // If this is set, GetUpdates will not get any data! // -// If you do not have a legitmate TLS certificate, you need to include +// If you do not have a legitimate TLS certificate, you need to include // your self signed certificate with the config. func (bot *BotAPI) SetWebhook(config WebhookConfig) (APIResponse, error) { if config.Certificate == nil {
M helpers.gohelpers.go

@@ -381,6 +381,16 @@ URL: url,

} } +// NewInlineQueryResultPhotoWithThumb creates a new inline query photo. +func NewInlineQueryResultPhotoWithThumb(id, url, thumb string) InlineQueryResultPhoto { + return InlineQueryResultPhoto{ + Type: "photo", + ID: id, + URL: url, + ThumbURL: thumb, + } +} + // NewInlineQueryResultVideo creates a new inline query video. func NewInlineQueryResultVideo(id, url string) InlineQueryResultVideo { return InlineQueryResultVideo{
M helpers_test.gohelpers_test.go

@@ -70,6 +70,17 @@ t.Fail()

} } +func TestNewInlineQueryResultPhotoWithThumb(t *testing.T) { + result := tgbotapi.NewInlineQueryResultPhotoWithThumb("id", "google.com", "thumb.com") + + if result.Type != "photo" || + result.ID != "id" || + result.URL != "google.com" || + result.ThumbURL != "thumb.com" { + t.Fail() + } +} + func TestNewInlineQueryResultVideo(t *testing.T) { result := tgbotapi.NewInlineQueryResultVideo("id", "google.com")