Skip to content

Commit

Permalink
Merge pull request tucnak#12 from Ronmi/markdown
Browse files Browse the repository at this point in the history
Support new API: markdown message.
  • Loading branch information
tucnak committed Sep 15, 2015
2 parents 5db9cc7 + 32d0662 commit 32efe8c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ func embedSendOptions(params *url.Values, options *SendOptions) {
params.Set("disable_web_page_preview", "true")
}

if options.ParseMode != ModeDefault {
params.Set("parse_mode", string(options.ParseMode))
}

// process reply_markup
if options.ReplyMarkup.ForceReply || options.ReplyMarkup.CustomKeyboard != nil || options.ReplyMarkup.HideCustomKeyboard {
replyMarkup, _ := json.Marshal(options.ReplyMarkup)
Expand Down
12 changes: 12 additions & 0 deletions options.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
package telebot

// ParseMode determines the way client applications treat the text of the message
type ParseMode string

// Supported ParseMode
const (
ModeDefault ParseMode = ""
ModeMarkdown ParseMode = "Markdown"
)

// SendOptions represents a set of custom options that could
// be appled to messages sent.
type SendOptions struct {
Expand All @@ -11,6 +20,9 @@ type SendOptions struct {

// For text messages, disables previews for links in this message.
DisableWebPagePreview bool

// ParseMode controls how client apps render your message.
ParseMode ParseMode
}

type ReplyMarkup struct {
Expand Down

0 comments on commit 32efe8c

Please sign in to comment.