all repos — telegram-bot-api @ ec221ba9ea458cd5386c35dd90af04b8a895f8eb

Golang bindings for the Telegram Bot API

Merge pull request #183 from 733amir/master

Add cached result types.
Syfaro syfaro@huefox.com
Tue, 25 Dec 2018 15:56:58 -0600
commit

ec221ba9ea458cd5386c35dd90af04b8a895f8eb

parent

9c399358c93e7e59818914ad7302f418d8365db4

2 files changed, 154 insertions(+), 1 deletions(-)

jump to
M helpers.gohelpers.go

@@ -459,6 +459,15 @@ URL: url,

} } +// NewInlineQueryResultCachedGIF create a new inline query with cached photo. +func NewInlineQueryResultCachedGIF(id, gifID string) InlineQueryResultCachedGIF { + return InlineQueryResultCachedGIF{ + Type: "gif", + ID: id, + GifID: gifID, + } +} + // NewInlineQueryResultMPEG4GIF creates a new inline query MPEG4 GIF. func NewInlineQueryResultMPEG4GIF(id, url string) InlineQueryResultMPEG4GIF { return InlineQueryResultMPEG4GIF{

@@ -468,6 +477,15 @@ URL: url,

} } +// NewInlineQueryResultCachedPhoto create a new inline query with cached photo. +func NewInlineQueryResultCachedMPEG4GIF(id, MPEG4GifID string) InlineQueryResultCachedMpeg4Gif { + return InlineQueryResultCachedMpeg4Gif{ + Type: "mpeg4_gif", + ID: id, + MGifID: MPEG4GifID, + } +} + // NewInlineQueryResultPhoto creates a new inline query photo. func NewInlineQueryResultPhoto(id, url string) InlineQueryResultPhoto { return InlineQueryResultPhoto{

@@ -487,6 +505,15 @@ ThumbURL: thumb,

} } +// NewInlineQueryResultCachedPhoto create a new inline query with cached photo. +func NewInlineQueryResultCachedPhoto(id, photoID string) InlineQueryResultCachedPhoto { + return InlineQueryResultCachedPhoto{ + Type: "photo", + ID: id, + PhotoID: photoID, + } +} + // NewInlineQueryResultVideo creates a new inline query video. func NewInlineQueryResultVideo(id, url string) InlineQueryResultVideo { return InlineQueryResultVideo{

@@ -496,6 +523,16 @@ URL: url,

} } +// NewInlineQueryResultCachedVideo create a new inline query with cached video. +func NewInlineQueryResultCachedVideo(id, videoID, title string) InlineQueryResultCachedVideo { + return InlineQueryResultCachedVideo{ + Type: "video", + ID: id, + VideoID: videoID, + Title: title, + } +} + // NewInlineQueryResultAudio creates a new inline query audio. func NewInlineQueryResultAudio(id, url, title string) InlineQueryResultAudio { return InlineQueryResultAudio{

@@ -506,6 +543,15 @@ Title: title,

} } +// NewInlineQueryResultCachedAudio create a new inline query with cached photo. +func NewInlineQueryResultCachedAudio(id, audioID string) InlineQueryResultCachedAudio { + return InlineQueryResultCachedAudio{ + Type: "audio", + ID: id, + AudioID: audioID, + } +} + // NewInlineQueryResultVoice creates a new inline query voice. func NewInlineQueryResultVoice(id, url, title string) InlineQueryResultVoice { return InlineQueryResultVoice{

@@ -516,6 +562,16 @@ Title: title,

} } +// NewInlineQueryResultCachedVoice create a new inline query with cached photo. +func NewInlineQueryResultCachedVoice(id, voiceID, title string) InlineQueryResultCachedVoice { + return InlineQueryResultCachedVoice{ + Type: "voice", + ID: id, + VoiceID: voiceID, + Title: title, + } +} + // NewInlineQueryResultDocument creates a new inline query document. func NewInlineQueryResultDocument(id, url, title, mimeType string) InlineQueryResultDocument { return InlineQueryResultDocument{

@@ -524,6 +580,16 @@ ID: id,

URL: url, Title: title, MimeType: mimeType, + } +} + +// NewInlineQueryResultCachedDocument create a new inline query with cached photo. +func NewInlineQueryResultCachedDocument(id, documentID, title string) InlineQueryResultCachedDocument { + return InlineQueryResultCachedDocument{ + Type: "document", + ID: id, + DocumentID: documentID, + Title: title, } }

@@ -556,7 +622,7 @@ BaseEdit: BaseEdit{

ChatID: chatID, MessageID: messageID, }, - Caption: caption, + Caption: caption, } }
M types.gotypes.go

@@ -586,6 +586,19 @@ ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

InputMessageContent interface{} `json:"input_message_content,omitempty"` } +// InlineQueryResultCachedPhoto is an inline query response with cached photo. +type InlineQueryResultCachedPhoto struct { + Type string `json:"type"` // required + ID string `json:"id"` // required + PhotoID string `json:"photo_file_id"` // required + Title string `json:"title"` + Description string `json:"description"` + Caption string `json:"caption"` + ParseMode string `json:"parse_mode"` + ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` + InputMessageContent interface{} `json:"input_message_content,omitempty"` +} + // InlineQueryResultGIF is an inline query response GIF. type InlineQueryResultGIF struct { Type string `json:"type"` // required

@@ -601,6 +614,18 @@ ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

InputMessageContent interface{} `json:"input_message_content,omitempty"` } +// InlineQueryResultCachedGIF is an inline query response with cached gif. +type InlineQueryResultCachedGIF struct { + Type string `json:"type"` // required + ID string `json:"id"` // required + GifID string `json:"gif_file_id"` // required + Title string `json:"title"` + Caption string `json:"caption"` + ParseMode string `json:"parse_mode"` + ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` + InputMessageContent interface{} `json:"input_message_content,omitempty"` +} + // InlineQueryResultMPEG4GIF is an inline query response MPEG4 GIF. type InlineQueryResultMPEG4GIF struct { Type string `json:"type"` // required

@@ -616,6 +641,19 @@ ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

InputMessageContent interface{} `json:"input_message_content,omitempty"` } +// InlineQueryResultCachedMpeg4Gif is an inline query response with cached +// H.264/MPEG-4 AVC video without sound gif. +type InlineQueryResultCachedMpeg4Gif struct { + Type string `json:"type"` // required + ID string `json:"id"` // required + MGifID string `json:"mpeg4_file_id"` // required + Title string `json:"title"` + Caption string `json:"caption"` + ParseMode string `json:"parse_mode"` + ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` + InputMessageContent interface{} `json:"input_message_content,omitempty"` +} + // InlineQueryResultVideo is an inline query response video. type InlineQueryResultVideo struct { Type string `json:"type"` // required

@@ -633,6 +671,19 @@ ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

InputMessageContent interface{} `json:"input_message_content,omitempty"` } +// InlineQueryResultCachedVideo is an inline query response with cached video. +type InlineQueryResultCachedVideo struct { + Type string `json:"type"` // required + ID string `json:"id"` // required + VideoID string `json:"video_file_id"` // required + Title string `json:"title"` // required + Description string `json:"description"` + Caption string `json:"caption"` + ParseMode string `json:"parse_mode"` + ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` + InputMessageContent interface{} `json:"input_message_content,omitempty"` +} + // InlineQueryResultAudio is an inline query response audio. type InlineQueryResultAudio struct { Type string `json:"type"` // required

@@ -646,6 +697,17 @@ ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

InputMessageContent interface{} `json:"input_message_content,omitempty"` } +// InlineQueryResultCachedAudio is an inline query response with cached audio. +type InlineQueryResultCachedAudio struct { + Type string `json:"type"` // required + ID string `json:"id"` // required + AudioID string `json:"audio_file_id"` // required + Caption string `json:"caption"` + ParseMode string `json:"parse_mode"` + ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` + InputMessageContent interface{} `json:"input_message_content,omitempty"` +} + // InlineQueryResultVoice is an inline query response voice. type InlineQueryResultVoice struct { Type string `json:"type"` // required

@@ -658,6 +720,18 @@ ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

InputMessageContent interface{} `json:"input_message_content,omitempty"` } +// InlineQueryResultCachedVoice is an inline query response with cached voice. +type InlineQueryResultCachedVoice struct { + Type string `json:"type"` // required + ID string `json:"id"` // required + VoiceID string `json:"voice_file_id"` // required + Title string `json:"title"` // required + Caption string `json:"caption"` + ParseMode string `json:"parse_mode"` + ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` + InputMessageContent interface{} `json:"input_message_content,omitempty"` +} + // InlineQueryResultDocument is an inline query response document. type InlineQueryResultDocument struct { Type string `json:"type"` // required

@@ -672,6 +746,19 @@ InputMessageContent interface{} `json:"input_message_content,omitempty"`

ThumbURL string `json:"thumb_url"` ThumbWidth int `json:"thumb_width"` ThumbHeight int `json:"thumb_height"` +} + +// InlineQueryResultCachedDocument is an inline query response with cached document. +type InlineQueryResultCachedDocument struct { + Type string `json:"type"` // required + ID string `json:"id"` // required + DocumentID string `json:"document_file_id"` // required + Title string `json:"title"` // required + Caption string `json:"caption"` + Description string `json:"description"` + ParseMode string `json:"parse_mode"` + ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` + InputMessageContent interface{} `json:"input_message_content,omitempty"` } // InlineQueryResultLocation is an inline query response location.