Skip to content

Commit ec221ba

Browse files
authored
Merge pull request #183 from 733amir/master
Add cached result types.
2 parents 9c39935 + 97ba9e1 commit ec221ba

File tree

2 files changed

+154
-1
lines changed

2 files changed

+154
-1
lines changed

helpers.go

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,15 @@ func NewInlineQueryResultGIF(id, url string) InlineQueryResultGIF {
459459
}
460460
}
461461

462+
// NewInlineQueryResultCachedGIF create a new inline query with cached photo.
463+
func NewInlineQueryResultCachedGIF(id, gifID string) InlineQueryResultCachedGIF {
464+
return InlineQueryResultCachedGIF{
465+
Type: "gif",
466+
ID: id,
467+
GifID: gifID,
468+
}
469+
}
470+
462471
// NewInlineQueryResultMPEG4GIF creates a new inline query MPEG4 GIF.
463472
func NewInlineQueryResultMPEG4GIF(id, url string) InlineQueryResultMPEG4GIF {
464473
return InlineQueryResultMPEG4GIF{
@@ -468,6 +477,15 @@ func NewInlineQueryResultMPEG4GIF(id, url string) InlineQueryResultMPEG4GIF {
468477
}
469478
}
470479

480+
// NewInlineQueryResultCachedPhoto create a new inline query with cached photo.
481+
func NewInlineQueryResultCachedMPEG4GIF(id, MPEG4GifID string) InlineQueryResultCachedMpeg4Gif {
482+
return InlineQueryResultCachedMpeg4Gif{
483+
Type: "mpeg4_gif",
484+
ID: id,
485+
MGifID: MPEG4GifID,
486+
}
487+
}
488+
471489
// NewInlineQueryResultPhoto creates a new inline query photo.
472490
func NewInlineQueryResultPhoto(id, url string) InlineQueryResultPhoto {
473491
return InlineQueryResultPhoto{
@@ -487,6 +505,15 @@ func NewInlineQueryResultPhotoWithThumb(id, url, thumb string) InlineQueryResult
487505
}
488506
}
489507

508+
// NewInlineQueryResultCachedPhoto create a new inline query with cached photo.
509+
func NewInlineQueryResultCachedPhoto(id, photoID string) InlineQueryResultCachedPhoto {
510+
return InlineQueryResultCachedPhoto{
511+
Type: "photo",
512+
ID: id,
513+
PhotoID: photoID,
514+
}
515+
}
516+
490517
// NewInlineQueryResultVideo creates a new inline query video.
491518
func NewInlineQueryResultVideo(id, url string) InlineQueryResultVideo {
492519
return InlineQueryResultVideo{
@@ -496,6 +523,16 @@ func NewInlineQueryResultVideo(id, url string) InlineQueryResultVideo {
496523
}
497524
}
498525

526+
// NewInlineQueryResultCachedVideo create a new inline query with cached video.
527+
func NewInlineQueryResultCachedVideo(id, videoID, title string) InlineQueryResultCachedVideo {
528+
return InlineQueryResultCachedVideo{
529+
Type: "video",
530+
ID: id,
531+
VideoID: videoID,
532+
Title: title,
533+
}
534+
}
535+
499536
// NewInlineQueryResultAudio creates a new inline query audio.
500537
func NewInlineQueryResultAudio(id, url, title string) InlineQueryResultAudio {
501538
return InlineQueryResultAudio{
@@ -506,6 +543,15 @@ func NewInlineQueryResultAudio(id, url, title string) InlineQueryResultAudio {
506543
}
507544
}
508545

546+
// NewInlineQueryResultCachedAudio create a new inline query with cached photo.
547+
func NewInlineQueryResultCachedAudio(id, audioID string) InlineQueryResultCachedAudio {
548+
return InlineQueryResultCachedAudio{
549+
Type: "audio",
550+
ID: id,
551+
AudioID: audioID,
552+
}
553+
}
554+
509555
// NewInlineQueryResultVoice creates a new inline query voice.
510556
func NewInlineQueryResultVoice(id, url, title string) InlineQueryResultVoice {
511557
return InlineQueryResultVoice{
@@ -516,6 +562,16 @@ func NewInlineQueryResultVoice(id, url, title string) InlineQueryResultVoice {
516562
}
517563
}
518564

565+
// NewInlineQueryResultCachedVoice create a new inline query with cached photo.
566+
func NewInlineQueryResultCachedVoice(id, voiceID, title string) InlineQueryResultCachedVoice {
567+
return InlineQueryResultCachedVoice{
568+
Type: "voice",
569+
ID: id,
570+
VoiceID: voiceID,
571+
Title: title,
572+
}
573+
}
574+
519575
// NewInlineQueryResultDocument creates a new inline query document.
520576
func NewInlineQueryResultDocument(id, url, title, mimeType string) InlineQueryResultDocument {
521577
return InlineQueryResultDocument{
@@ -527,6 +583,16 @@ func NewInlineQueryResultDocument(id, url, title, mimeType string) InlineQueryRe
527583
}
528584
}
529585

586+
// NewInlineQueryResultCachedDocument create a new inline query with cached photo.
587+
func NewInlineQueryResultCachedDocument(id, documentID, title string) InlineQueryResultCachedDocument {
588+
return InlineQueryResultCachedDocument{
589+
Type: "document",
590+
ID: id,
591+
DocumentID: documentID,
592+
Title: title,
593+
}
594+
}
595+
530596
// NewInlineQueryResultLocation creates a new inline query location.
531597
func NewInlineQueryResultLocation(id, title string, latitude, longitude float64) InlineQueryResultLocation {
532598
return InlineQueryResultLocation{
@@ -556,7 +622,7 @@ func NewEditMessageCaption(chatID int64, messageID int, caption string) EditMess
556622
ChatID: chatID,
557623
MessageID: messageID,
558624
},
559-
Caption: caption,
625+
Caption: caption,
560626
}
561627
}
562628

types.go

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,19 @@ type InlineQueryResultPhoto struct {
586586
InputMessageContent interface{} `json:"input_message_content,omitempty"`
587587
}
588588

589+
// InlineQueryResultCachedPhoto is an inline query response with cached photo.
590+
type InlineQueryResultCachedPhoto struct {
591+
Type string `json:"type"` // required
592+
ID string `json:"id"` // required
593+
PhotoID string `json:"photo_file_id"` // required
594+
Title string `json:"title"`
595+
Description string `json:"description"`
596+
Caption string `json:"caption"`
597+
ParseMode string `json:"parse_mode"`
598+
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
599+
InputMessageContent interface{} `json:"input_message_content,omitempty"`
600+
}
601+
589602
// InlineQueryResultGIF is an inline query response GIF.
590603
type InlineQueryResultGIF struct {
591604
Type string `json:"type"` // required
@@ -601,6 +614,18 @@ type InlineQueryResultGIF struct {
601614
InputMessageContent interface{} `json:"input_message_content,omitempty"`
602615
}
603616

617+
// InlineQueryResultCachedGIF is an inline query response with cached gif.
618+
type InlineQueryResultCachedGIF struct {
619+
Type string `json:"type"` // required
620+
ID string `json:"id"` // required
621+
GifID string `json:"gif_file_id"` // required
622+
Title string `json:"title"`
623+
Caption string `json:"caption"`
624+
ParseMode string `json:"parse_mode"`
625+
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
626+
InputMessageContent interface{} `json:"input_message_content,omitempty"`
627+
}
628+
604629
// InlineQueryResultMPEG4GIF is an inline query response MPEG4 GIF.
605630
type InlineQueryResultMPEG4GIF struct {
606631
Type string `json:"type"` // required
@@ -616,6 +641,19 @@ type InlineQueryResultMPEG4GIF struct {
616641
InputMessageContent interface{} `json:"input_message_content,omitempty"`
617642
}
618643

644+
// InlineQueryResultCachedMpeg4Gif is an inline query response with cached
645+
// H.264/MPEG-4 AVC video without sound gif.
646+
type InlineQueryResultCachedMpeg4Gif struct {
647+
Type string `json:"type"` // required
648+
ID string `json:"id"` // required
649+
MGifID string `json:"mpeg4_file_id"` // required
650+
Title string `json:"title"`
651+
Caption string `json:"caption"`
652+
ParseMode string `json:"parse_mode"`
653+
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
654+
InputMessageContent interface{} `json:"input_message_content,omitempty"`
655+
}
656+
619657
// InlineQueryResultVideo is an inline query response video.
620658
type InlineQueryResultVideo struct {
621659
Type string `json:"type"` // required
@@ -633,6 +671,19 @@ type InlineQueryResultVideo struct {
633671
InputMessageContent interface{} `json:"input_message_content,omitempty"`
634672
}
635673

674+
// InlineQueryResultCachedVideo is an inline query response with cached video.
675+
type InlineQueryResultCachedVideo struct {
676+
Type string `json:"type"` // required
677+
ID string `json:"id"` // required
678+
VideoID string `json:"video_file_id"` // required
679+
Title string `json:"title"` // required
680+
Description string `json:"description"`
681+
Caption string `json:"caption"`
682+
ParseMode string `json:"parse_mode"`
683+
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
684+
InputMessageContent interface{} `json:"input_message_content,omitempty"`
685+
}
686+
636687
// InlineQueryResultAudio is an inline query response audio.
637688
type InlineQueryResultAudio struct {
638689
Type string `json:"type"` // required
@@ -646,6 +697,17 @@ type InlineQueryResultAudio struct {
646697
InputMessageContent interface{} `json:"input_message_content,omitempty"`
647698
}
648699

700+
// InlineQueryResultCachedAudio is an inline query response with cached audio.
701+
type InlineQueryResultCachedAudio struct {
702+
Type string `json:"type"` // required
703+
ID string `json:"id"` // required
704+
AudioID string `json:"audio_file_id"` // required
705+
Caption string `json:"caption"`
706+
ParseMode string `json:"parse_mode"`
707+
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
708+
InputMessageContent interface{} `json:"input_message_content,omitempty"`
709+
}
710+
649711
// InlineQueryResultVoice is an inline query response voice.
650712
type InlineQueryResultVoice struct {
651713
Type string `json:"type"` // required
@@ -658,6 +720,18 @@ type InlineQueryResultVoice struct {
658720
InputMessageContent interface{} `json:"input_message_content,omitempty"`
659721
}
660722

723+
// InlineQueryResultCachedVoice is an inline query response with cached voice.
724+
type InlineQueryResultCachedVoice struct {
725+
Type string `json:"type"` // required
726+
ID string `json:"id"` // required
727+
VoiceID string `json:"voice_file_id"` // required
728+
Title string `json:"title"` // required
729+
Caption string `json:"caption"`
730+
ParseMode string `json:"parse_mode"`
731+
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
732+
InputMessageContent interface{} `json:"input_message_content,omitempty"`
733+
}
734+
661735
// InlineQueryResultDocument is an inline query response document.
662736
type InlineQueryResultDocument struct {
663737
Type string `json:"type"` // required
@@ -674,6 +748,19 @@ type InlineQueryResultDocument struct {
674748
ThumbHeight int `json:"thumb_height"`
675749
}
676750

751+
// InlineQueryResultCachedDocument is an inline query response with cached document.
752+
type InlineQueryResultCachedDocument struct {
753+
Type string `json:"type"` // required
754+
ID string `json:"id"` // required
755+
DocumentID string `json:"document_file_id"` // required
756+
Title string `json:"title"` // required
757+
Caption string `json:"caption"`
758+
Description string `json:"description"`
759+
ParseMode string `json:"parse_mode"`
760+
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
761+
InputMessageContent interface{} `json:"input_message_content,omitempty"`
762+
}
763+
677764
// InlineQueryResultLocation is an inline query response location.
678765
type InlineQueryResultLocation struct {
679766
Type string `json:"type"` // required

0 commit comments

Comments
 (0)