From 3beea1c055a224a3ac39007f8ff81c38d82b4348 Mon Sep 17 00:00:00 2001 From: demiangetman Date: Mon, 28 Oct 2019 22:22:30 +0300 Subject: [PATCH 1/2] Update inline query result types --- inline_types.go | 67 +++++++++++++++++++++++++++++++++++++++++++++++++ telebot.go | 2 +- 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/inline_types.go b/inline_types.go index c959d42..5d542af 100644 --- a/inline_types.go +++ b/inline_types.go @@ -65,6 +65,12 @@ type ArticleResult struct { // Optional. URL of the thumbnail for the result. ThumbURL string `json:"thumb_url,omitempty"` + + // Optional. Width of the thumbnail for the result. + ThumbWidth int `json:"thumb_width,omitempty"` + + // Optional. Height of the thumbnail for the result. + ThumbHeight int `json:"thumb_height,omitempty"` } // AudioResult represents a link to an mp3 audio file. @@ -83,6 +89,13 @@ type AudioResult struct { // Optional. Audio duration in seconds. Duration int `json:"audio_duration,omitempty"` + // Optional. Caption, 0-1024 characters. + Caption string `json:"caption,omitempty"` + + // Optional. Send Markdown or HTML, if you want Telegram apps to show + // bold, italic, fixed-width text or inline URLs in the media caption. + ParseMode ParseMode `json:"parse_mode,omitempty"` + // If Cache != "", it'll be used instead Cache string `json:"audio_file_id,omitempty"` } @@ -95,6 +108,9 @@ type ContactResult struct { // Contact's phone number. PhoneNumber string `json:"phone_number"` + // Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes. + VCard string `json:"vcard,omitempty"` + // Contact's first name. FirstName string `json:"first_name"` @@ -103,6 +119,12 @@ type ContactResult struct { // Optional. URL of the thumbnail for the result. ThumbURL string `json:"thumb_url,omitempty"` + + // Optional. Width of the thumbnail for the result. + ThumbWidth int `json:"thumb_width,omitempty"` + + // Optional. Height of the thumbnail for the result. + ThumbHeight int `json:"thumb_height,omitempty"` } // DocumentResult represents a link to a file. @@ -123,12 +145,22 @@ type DocumentResult struct { // Optional. Caption of the document to be sent, 0-200 characters. Caption string `json:"caption,omitempty"` + // Optional. Send Markdown or HTML, if you want Telegram apps to show + // bold, italic, fixed-width text or inline URLs in the media caption. + ParseMode ParseMode `json:"parse_mode,omitempty"` + // Optional. Short description of the result. Description string `json:"description,omitempty"` // Optional. URL of the thumbnail (jpeg only) for the file. ThumbURL string `json:"thumb_url,omitempty"` + // Optional. Width of the thumbnail for the result. + ThumbWidth int `json:"thumb_width,omitempty"` + + // Optional. Height of the thumbnail for the result. + ThumbHeight int `json:"thumb_height,omitempty"` + // If Cache != "", it'll be used instead Cache string `json:"document_file_id,omitempty"` } @@ -147,12 +179,19 @@ type GifResult struct { // Optional. Height of the GIF. Height int `json:"gif_height,omitempty"` + // Optional. Duration of the GIF. + Duration int `json:"gif_duration,omitempty"` + // Optional. Title for the result. Title string `json:"title,omitempty"` // Optional. Caption of the GIF file to be sent, 0-200 characters. Caption string `json:"caption,omitempty"` + // Optional. Send Markdown or HTML, if you want Telegram apps to show + // bold, italic, fixed-width text or inline URLs in the media caption. + ParseMode ParseMode `json:"parse_mode,omitempty"` + // URL of the static thumbnail for the result (jpeg or gif). ThumbURL string `json:"thumb_url"` @@ -189,6 +228,9 @@ type Mpeg4GifResult struct { // Optional. Video height. Height int `json:"mpeg4_height,omitempty"` + // Optional. Video duration. + Duration int `json:"mpeg4_duration,omitempty"` + // URL of the static thumbnail (jpeg or gif) for the result. ThumbURL string `json:"thumb_url,omitempty"` @@ -198,6 +240,10 @@ type Mpeg4GifResult struct { // Optional. Caption of the MPEG-4 file to be sent, 0-200 characters. Caption string `json:"caption,omitempty"` + // Optional. Send Markdown or HTML, if you want Telegram apps to show + // bold, italic, fixed-width text or inline URLs in the media caption. + ParseMode ParseMode `json:"parse_mode,omitempty"` + // If Cache != "", it'll be used instead Cache string `json:"mpeg4_file_id,omitempty"` } @@ -226,6 +272,10 @@ type PhotoResult struct { // Optional. Caption of the photo to be sent, 0-200 characters. Caption string `json:"caption,omitempty"` + // Optional. Send Markdown or HTML, if you want Telegram apps to show + // bold, italic, fixed-width text or inline URLs in the media caption. + ParseMode ParseMode `json:"parse_mode,omitempty"` + // URL of the thumbnail for the photo. ThumbURL string `json:"thumb_url"` @@ -251,6 +301,12 @@ type VenueResult struct { // Optional. URL of the thumbnail for the result. ThumbURL string `json:"thumb_url,omitempty"` + + // Optional. Width of the thumbnail for the result. + ThumbWidth int `json:"thumb_width,omitempty"` + + // Optional. Height of the thumbnail for the result. + ThumbHeight int `json:"thumb_height,omitempty"` } // VideoResult represents a link to a page containing an embedded @@ -274,6 +330,10 @@ type VideoResult struct { // Optional. Caption of the video to be sent, 0-200 characters. Caption string `json:"caption,omitempty"` + // Optional. Send Markdown or HTML, if you want Telegram apps to show + // bold, italic, fixed-width text or inline URLs in the media caption. + ParseMode ParseMode `json:"parse_mode,omitempty"` + // Optional. Video width. Width int `json:"video_width,omitempty"` @@ -306,6 +366,13 @@ type VoiceResult struct { // Optional. Recording duration in seconds. Duration int `json:"voice_duration"` + // Optional. Caption, 0-1024 characters. + Caption string `json:"caption,omitempty"` + + // Optional. Send Markdown or HTML, if you want Telegram apps to show + // bold, italic, fixed-width text or inline URLs in the media caption. + ParseMode ParseMode `json:"parse_mode,omitempty"` + // If Cache != "", it'll be used instead Cache string `json:"voice_file_id,omitempty"` } diff --git a/telebot.go b/telebot.go index ae9f59d..2982d88 100644 --- a/telebot.go +++ b/telebot.go @@ -106,7 +106,7 @@ const ( ) // ParseMode determines the way client applications treat the text of the message -type ParseMode string +type ParseMode = string const ( ModeDefault ParseMode = "" From f096d2b1adbce2ba548dd75414c26b909a2703ce Mon Sep 17 00:00:00 2001 From: Viktor Oreshkin Date: Thu, 16 Apr 2020 10:17:17 +0300 Subject: [PATCH 2/2] unconvert ParseMode string cast --- util.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util.go b/util.go index cd6aa67..d18fe6d 100644 --- a/util.go +++ b/util.go @@ -177,7 +177,7 @@ func embedSendOptions(params map[string]string, opt *SendOptions) { } if opt.ParseMode != ModeDefault { - params["parse_mode"] = string(opt.ParseMode) + params["parse_mode"] = opt.ParseMode } if opt.ReplyMarkup != nil {