Skip to content

Commit

Permalink
Add NewInlineQueryResultPhotoWithThumb for #54.
Browse files Browse the repository at this point in the history
  • Loading branch information
Syfaro committed Jul 26, 2016
1 parent 1daed40 commit 4f996f7
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bot.go
Expand Up @@ -396,7 +396,7 @@ func (bot *BotAPI) RemoveWebhook() (APIResponse, error) {
//
// 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 {
Expand Down
10 changes: 10 additions & 0 deletions helpers.go
Expand Up @@ -381,6 +381,16 @@ func NewInlineQueryResultPhoto(id, url string) InlineQueryResultPhoto {
}
}

// 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{
Expand Down
11 changes: 11 additions & 0 deletions helpers_test.go
Expand Up @@ -70,6 +70,17 @@ func TestNewInlineQueryResultPhoto(t *testing.T) {
}
}

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")

Expand Down

0 comments on commit 4f996f7

Please sign in to comment.