Add support for Markdown/HTML in NewInlineQueryResultArticle
parent
217764ba45
commit
64f1ab7a89
|
@ -317,13 +317,14 @@ func NewWebhookWithCert(link string, file interface{}) WebhookConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewInlineQueryResultArticle creates a new inline query article.
|
// 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{
|
return InlineQueryResultArticle{
|
||||||
Type: "article",
|
Type: "article",
|
||||||
ID: id,
|
ID: id,
|
||||||
Title: title,
|
Title: title,
|
||||||
InputMessageContent: InputTextMessageContent{
|
InputMessageContent: InputTextMessageContent{
|
||||||
Text: messageText,
|
Text: messageText,
|
||||||
|
ParseMode: parseMode,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,12 +6,13 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNewInlineQueryResultArticle(t *testing.T) {
|
func TestNewInlineQueryResultArticle(t *testing.T) {
|
||||||
result := tgbotapi.NewInlineQueryResultArticle("id", "title", "message")
|
result := tgbotapi.NewInlineQueryResultArticle("id", "title", "message", "Markdown")
|
||||||
|
|
||||||
if result.Type != "article" ||
|
if result.Type != "article" ||
|
||||||
result.ID != "id" ||
|
result.ID != "id" ||
|
||||||
result.Title != "title" ||
|
result.Title != "title" ||
|
||||||
result.InputMessageContent.(tgbotapi.InputTextMessageContent).Text != "message" {
|
result.InputMessageContent.(tgbotapi.InputTextMessageContent).Text != "message" ||
|
||||||
|
result.InputMessageContent.(tgbotapi.InputTextMessageContent).ParseMode != "Markdown" {
|
||||||
t.Fail()
|
t.Fail()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue