all repos — telegram-bot-api @ 236ac39b3448e02c9181a878928b592f53fe7191

Golang bindings for the Telegram Bot API

Merge pull request #22 from jqs7/master

add markdown support
Syfaro syfaro@foxpaw.in
Sat, 12 Sep 2015 09:09:48 -0500
commit

236ac39b3448e02c9181a878928b592f53fe7191

parent

8b33fd5a507598ec18d38a51be13f7fe0300d6cd

1 files changed, 9 insertions(+), 0 deletions(-)

jump to
M methods.gomethods.go

@@ -39,10 +39,16 @@ // APIForbidden happens when a token is bad

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{}

@@ -308,6 +314,9 @@ v := url.Values{}

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