add markdown support
parent
ae7c1b4e22
commit
86e4fadcb0
|
@ -38,10 +38,16 @@ const (
|
||||||
APIForbidden = "forbidden"
|
APIForbidden = "forbidden"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Constant values for ParseMode in MessageConfig
|
||||||
|
const (
|
||||||
|
ModeMarkdown = "Markdown"
|
||||||
|
)
|
||||||
|
|
||||||
// MessageConfig contains information about a SendMessage request.
|
// MessageConfig contains information about a SendMessage request.
|
||||||
type MessageConfig struct {
|
type MessageConfig struct {
|
||||||
ChatID int
|
ChatID int
|
||||||
Text string
|
Text string
|
||||||
|
ParseMode string
|
||||||
DisableWebPagePreview bool
|
DisableWebPagePreview bool
|
||||||
ReplyToMessageID int
|
ReplyToMessageID int
|
||||||
ReplyMarkup interface{}
|
ReplyMarkup interface{}
|
||||||
|
@ -262,6 +268,9 @@ func (bot *BotAPI) SendMessage(config MessageConfig) (Message, error) {
|
||||||
v.Add("chat_id", strconv.Itoa(config.ChatID))
|
v.Add("chat_id", strconv.Itoa(config.ChatID))
|
||||||
v.Add("text", config.Text)
|
v.Add("text", config.Text)
|
||||||
v.Add("disable_web_page_preview", strconv.FormatBool(config.DisableWebPagePreview))
|
v.Add("disable_web_page_preview", strconv.FormatBool(config.DisableWebPagePreview))
|
||||||
|
if config.ParseMode != "" {
|
||||||
|
v.Add("parse_mode", config.ParseMode)
|
||||||
|
}
|
||||||
if config.ReplyToMessageID != 0 {
|
if config.ReplyToMessageID != 0 {
|
||||||
v.Add("reply_to_message_id", strconv.Itoa(config.ReplyToMessageID))
|
v.Add("reply_to_message_id", strconv.Itoa(config.ReplyToMessageID))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue