Skip to content

Commit 4f996f7

Browse files
author
Syfaro
committed
Add NewInlineQueryResultPhotoWithThumb for #54.
1 parent 1daed40 commit 4f996f7

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

bot.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ func (bot *BotAPI) RemoveWebhook() (APIResponse, error) {
396396
//
397397
// If this is set, GetUpdates will not get any data!
398398
//
399-
// If you do not have a legitmate TLS certificate, you need to include
399+
// If you do not have a legitimate TLS certificate, you need to include
400400
// your self signed certificate with the config.
401401
func (bot *BotAPI) SetWebhook(config WebhookConfig) (APIResponse, error) {
402402
if config.Certificate == nil {

helpers.go

+10
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,16 @@ func NewInlineQueryResultPhoto(id, url string) InlineQueryResultPhoto {
381381
}
382382
}
383383

384+
// NewInlineQueryResultPhotoWithThumb creates a new inline query photo.
385+
func NewInlineQueryResultPhotoWithThumb(id, url, thumb string) InlineQueryResultPhoto {
386+
return InlineQueryResultPhoto{
387+
Type: "photo",
388+
ID: id,
389+
URL: url,
390+
ThumbURL: thumb,
391+
}
392+
}
393+
384394
// NewInlineQueryResultVideo creates a new inline query video.
385395
func NewInlineQueryResultVideo(id, url string) InlineQueryResultVideo {
386396
return InlineQueryResultVideo{

helpers_test.go

+11
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,17 @@ func TestNewInlineQueryResultPhoto(t *testing.T) {
7070
}
7171
}
7272

73+
func TestNewInlineQueryResultPhotoWithThumb(t *testing.T) {
74+
result := tgbotapi.NewInlineQueryResultPhotoWithThumb("id", "google.com", "thumb.com")
75+
76+
if result.Type != "photo" ||
77+
result.ID != "id" ||
78+
result.URL != "google.com" ||
79+
result.ThumbURL != "thumb.com" {
80+
t.Fail()
81+
}
82+
}
83+
7384
func TestNewInlineQueryResultVideo(t *testing.T) {
7485
result := tgbotapi.NewInlineQueryResultVideo("id", "google.com")
7586

0 commit comments

Comments
 (0)