Documentation ¶
Index ¶
- Constants
- Variables
- func ValidMsgtype(msgtype string) bool
- type ActionCard
- type At
- type Btn
- type DingtalkGroupBot
- func (bot *DingtalkGroupBot) Addr() string
- func (bot *DingtalkGroupBot) AddrForUpload() string
- func (bot *DingtalkGroupBot) SendAs(m *models.Payload, msgType string) 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 Sender
- type Text
Constants ¶
View Source
const ( MsgTypeText = "text" MsgTypeMarkdown = "markdown" MsgTypeLink = "link" MsgTypeFeedCard = "feedcard" MsgTypeActionCard = "actioncard" )
View Source
const ChannelTypeDingtalk = "dingtalk"
Variables ¶
View Source
var SupportedMsgtype = make(map[string]bool)
Functions ¶
func ValidMsgtype ¶
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/custom-robot-access/title-72m-8ag-pqw
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) SendAs ¶
func (bot *DingtalkGroupBot) SendAs(m *models.Payload, msgType string) 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 ¶
Click to show internal directories.
Click to hide internal directories.