Documentation ¶
Index ¶
- Constants
- Variables
- func NewSender(token string, msgType string) models.Sender
- func SanitizeMarkdown(content string) string
- func ValidMsg(msgType string, msg *Msg) error
- type ActionCard
- type At
- type Btn
- type DingtalkGroupBot
- func (bot *DingtalkGroupBot) Addr() string
- func (bot *DingtalkGroupBot) AddrForUpload() string
- func (bot *DingtalkGroupBot) Send(msg *Msg) error
- func (bot *DingtalkGroupBot) SendText(content string, atMobiles []string, atAll bool) error
- func (bot *DingtalkGroupBot) UploadFile(filename string, fileReader io.Reader) (meidaID string, err error)
- type FeedCard
- type FeedCardLink
- type Link
- type Markdown
- type Msg
- func NewMsgActionCard(actionCard *ActionCard) *Msg
- func NewMsgActionCardFromPayload(p *models.Payload) *Msg
- func NewMsgFeedCard(feedCard *FeedCard) *Msg
- func NewMsgFeedCardFromPayload(payload *models.Payload) *Msg
- func NewMsgLink(link *Link) *Msg
- func NewMsgLinkFromPayload(payload *models.Payload) *Msg
- func NewMsgMarkdown(md *Markdown) *Msg
- func NewMsgMarkdownFromPayload(payload *models.Payload) *Msg
- func NewMsgText(text *Text) *Msg
- func NewMsgTextFromPayload(payload *models.Payload) *Msg
- type Payload2MsgFn
- type Sender
- type Text
Constants ¶
Variables ¶
View Source
var Payload2MsgFnMap = make(map[string]Payload2MsgFn)
Functions ¶
func SanitizeMarkdown ¶
Types ¶
type ActionCard ¶
type ActionCard struct { Title string `json:"title"` // seems no meaning now Text string `json:"text"` // support markdown format Btnorientation string `json:"btnOrientation"` // 0:按钮竖直排列, 1:按钮横向排列 Hideavatar string `json:"hideAvatar,omitempty"` Singletitle string `json:"singleTitle,omitempty"` Singleurl string `json:"singleURL,omitempty"` Btns []*Btn `json:"btns,omitempty"` }
func NewActionCard ¶
func NewActionCard(title string, text string, horizonBtn bool, btns []*Btn) *ActionCard
type DingtalkGroupBot ¶
type DingtalkGroupBot struct {
// contains filtered or unexported fields
}
DingtalkBot can send messages to dingtalk group ref: https://developers.dingtalk.com/document/app/message-types-and-data-format
func NewDingtalkGroupBot ¶
func NewDingtalkGroupBot(access_token string) *DingtalkGroupBot
func (*DingtalkGroupBot) Addr ¶
func (bot *DingtalkGroupBot) Addr() string
func (*DingtalkGroupBot) AddrForUpload ¶
func (bot *DingtalkGroupBot) AddrForUpload() string
func (*DingtalkGroupBot) Send ¶ added in v0.1.0
func (bot *DingtalkGroupBot) Send(msg *Msg) error
func (*DingtalkGroupBot) SendText ¶
func (bot *DingtalkGroupBot) SendText(content string, atMobiles []string, atAll bool) error
func (*DingtalkGroupBot) UploadFile ¶
type FeedCard ¶
type FeedCard struct {
Links []*FeedCardLink `json:"links"`
}
func NewFeedCard ¶
func NewFeedCard(links []*FeedCardLink) *FeedCard
type FeedCardLink ¶
type FeedCardLink struct { Title string `json:"title"` MessageURL string `json:"messageURL"` PicURL string `json:"picURL"` }
func NewFeedCardLink ¶
func NewFeedCardLink(title, messageURl, picURL string) *FeedCardLink
type Link ¶
type Link struct { Text string `json:"text"` Title string `json:"title"` PicURL string `json:"picUrl"` MessageURL string `json:"messageUrl"` }
func (*Link) WithPicURL ¶
type Markdown ¶
func NewMarkdown ¶
type Msg ¶
type Msg struct { MsgType string `json:"msgtype"` Text *Text `json:"text,omitempty"` Link *Link `json:"link,omitempty"` Markdown *Markdown `json:"markdown,omitempty"` ActionCard *ActionCard `json:"actionCard,omitempty"` FeedCard *FeedCard `json:"feedCard,omitempty"` At *At `json:"at,omitempty"` // only available for text and markdown type }
func NewMsgActionCard ¶
func NewMsgActionCard(actionCard *ActionCard) *Msg
func NewMsgFeedCard ¶
func NewMsgLink ¶
func NewMsgLinkFromPayload ¶
func NewMsgMarkdown ¶
func NewMsgText ¶
func NewMsgTextFromPayload ¶
func (*Msg) WithAtMobiles ¶
type Payload2MsgFn ¶ added in v0.1.0
Click to show internal directories.
Click to hide internal directories.