package dingtalkrobot import "fmt" type message interface { String() string } type MarkdownMessage struct { MsgType string `json:"msgtype"` Markdown markdown `json:"markdown"` } type markdown struct { Title string `json:"title"` Text string `json:"text"` } func (m *MarkdownMessage) String() string { return fmt.Sprintf("markdown message, title: %v, content: %v", m.Markdown.Title, m.Markdown.Text) } func NewMarkdownMessage(title string, content string) *MarkdownMessage { return &MarkdownMessage{ MsgType: "markdown", Markdown: markdown{ Title: title, Text: content, }, } }