-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmarkdown.go
More file actions
25 lines (22 loc) · 837 Bytes
/
markdown.go
File metadata and controls
25 lines (22 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package wecombot
// MarkdownMessage Markdown 类型消息。详见 https://developer.work.weixin.qq.com/document/path/91770#markdown%E7%B1%BB%E5%9E%8B
type MarkdownMessage struct {
// MsgType 必填。消息类型,此时固定为 markdown 。
MsgType MsgType `json:"msgtype"`
// 消息内容
Markdown struct {
// Content 必填。markdown内容,最长不超过4096个字节,必须是utf8编码。
Content string `json:"content"`
} `json:"markdown"`
}
// SendMarkdownMessage 发送 Markdown 消息
func (bot *Bot) SendMarkdownMessage(msg *MarkdownMessage) (err error) {
msg.MsgType = MarkdownMsgType
return bot.send(msg)
}
// SendMarkdown 发送 Markdown 消息
func (bot *Bot) SendMarkdown(content string) (err error) {
var msg MarkdownMessage
msg.Markdown.Content = content
return bot.SendMarkdownMessage(&msg)
}