From 64f1ab7a891fbd03e752718564be8194011becb3 Mon Sep 17 00:00:00 2001 From: Maxim Martyanov Date: Thu, 2 Jun 2016 22:42:05 +0300 Subject: [PATCH] Add support for Markdown/HTML in NewInlineQueryResultArticle --- helpers.go | 3 ++- helpers_test.go | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/helpers.go b/helpers.go index 7240831..5d98cba 100644 --- a/helpers.go +++ b/helpers.go @@ -317,13 +317,14 @@ func NewWebhookWithCert(link string, file interface{}) WebhookConfig { } // NewInlineQueryResultArticle creates a new inline query article. -func NewInlineQueryResultArticle(id, title, messageText string) InlineQueryResultArticle { +func NewInlineQueryResultArticle(id, title, messageText string, parseMode string) InlineQueryResultArticle { return InlineQueryResultArticle{ Type: "article", ID: id, Title: title, InputMessageContent: InputTextMessageContent{ Text: messageText, + ParseMode: parseMode, }, } } diff --git a/helpers_test.go b/helpers_test.go index 64ffe1f..ed17d07 100644 --- a/helpers_test.go +++ b/helpers_test.go @@ -6,12 +6,13 @@ import ( ) func TestNewInlineQueryResultArticle(t *testing.T) { - result := tgbotapi.NewInlineQueryResultArticle("id", "title", "message") + result := tgbotapi.NewInlineQueryResultArticle("id", "title", "message", "Markdown") if result.Type != "article" || result.ID != "id" || result.Title != "title" || - result.InputMessageContent.(tgbotapi.InputTextMessageContent).Text != "message" { + result.InputMessageContent.(tgbotapi.InputTextMessageContent).Text != "message" || + result.InputMessageContent.(tgbotapi.InputTextMessageContent).ParseMode != "Markdown" { t.Fail() } }