From 86e4fadcb08f7b67df0f7913f06ee13c59dd67b7 Mon Sep 17 00:00:00 2001 From: Jqs7 <7@jqs7.com> Date: Sat, 12 Sep 2015 19:30:49 +0800 Subject: [PATCH] add markdown support --- methods.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/methods.go b/methods.go index 40b82e2..dd0b84c 100644 --- a/methods.go +++ b/methods.go @@ -38,10 +38,16 @@ const ( APIForbidden = "forbidden" ) +// Constant values for ParseMode in MessageConfig +const ( + ModeMarkdown = "Markdown" +) + // MessageConfig contains information about a SendMessage request. type MessageConfig struct { ChatID int Text string + ParseMode string DisableWebPagePreview bool ReplyToMessageID int ReplyMarkup interface{} @@ -262,6 +268,9 @@ func (bot *BotAPI) SendMessage(config MessageConfig) (Message, error) { v.Add("chat_id", strconv.Itoa(config.ChatID)) v.Add("text", config.Text) v.Add("disable_web_page_preview", strconv.FormatBool(config.DisableWebPagePreview)) + if config.ParseMode != "" { + v.Add("parse_mode", config.ParseMode) + } if config.ReplyToMessageID != 0 { v.Add("reply_to_message_id", strconv.Itoa(config.ReplyToMessageID)) }