all repos — telegram-bot-api @ 64f1ab7a891fbd03e752718564be8194011becb3

Golang bindings for the Telegram Bot API

Add support for Markdown/HTML in NewInlineQueryResultArticle
Maxim Martyanov me@llorephie.org
Thu, 02 Jun 2016 22:42:05 +0300
commit

64f1ab7a891fbd03e752718564be8194011becb3

parent

217764ba453f319b00d05506e56d26ef0a9fc231

2 files changed, 5 insertions(+), 3 deletions(-)

jump to
M helpers.gohelpers.go

@@ -317,13 +317,14 @@ }

} // 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, }, } }
M helpers_test.gohelpers_test.go

@@ -6,12 +6,13 @@ "testing"

) 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() } }