Documentation
¶
Index ¶
- Variables
- func SetDebug(debug bool)
- type Article
- type ArticleOption
- type Media
- type TemplateCardAction
- type TemplateCardHorizontalContentOption
- type TemplateCardImageOption
- type TemplateCardJumpOption
- type TemplateCardMainTitleOption
- type TemplateCardOption
- func TemplateCardEmphasisContent(title, desc string) TemplateCardOption
- func TemplateCardHorizontalContent(keyName string, opt TemplateCardHorizontalContentOption) TemplateCardOption
- func TemplateCardJump(title string, opt TemplateCardJumpOption) TemplateCardOption
- func TemplateCardSource(iconUrl, desc string) TemplateCardOption
- func TemplateCardSubTitleText(subTitle string) TemplateCardOption
- func TemplateCardVerticalContent(title, desc string) TemplateCardOption
- type TextMsgOption
- type WeComBot
Constants ¶
This section is empty.
Variables ¶
View Source
var BotSendUrl = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=%s"
BotSendUrl 企业微信群机器人 webhook
View Source
var HTTPClient = http.DefaultClient
View Source
var UploadMediaUrl = "https://qyapi.weixin.qq.com/cgi-bin/webhook/upload_media?key=%s&type=file"
UploadMediaUrl 企业微信上传文件接口 `url`, `type` 固定传 `file`
Functions ¶
Types ¶
type Article ¶
type Article struct { // **必填** 标题, 不超过 128 个字节, 超过会自动截断 Title string `json:"title"` // **选填** 描述, 不超过 512 个字节, 超过会自动截断 Description string `json:"description,omitempty"` // **必填** 点击后跳转的链接 Url string `json:"url"` // **选填** 图文消息的图片链接, 支持 `JPG`、`PNG` 格式, 较好的效果为大图 `1068*455`, 小图 `150*150` PicUrl string `json:"picurl,omitempty"` }
func NewArticle ¶
func NewArticle(title, Url string, opts ...ArticleOption) Article
type ArticleOption ¶
type ArticleOption func(d *Article)
func ArticleDescription ¶
func ArticleDescription(desc string) ArticleOption
func ArticlePicUrl ¶
func ArticlePicUrl(picUrl string) ArticleOption
type TemplateCardAction ¶ added in v0.2.0
type TemplateCardAction func(act *templateCardAction)
func TemplateCardActionApp ¶ added in v0.2.0
func TemplateCardActionApp(appID string, pagePath string) TemplateCardAction
func TemplateCardActionUrl ¶ added in v0.2.0
func TemplateCardActionUrl(rawUrl string) TemplateCardAction
type TemplateCardHorizontalContentOption ¶ added in v0.2.0
type TemplateCardHorizontalContentOption func(hc *templateCardHorizontalContent)
func TemplateCardHorizontalContentMedia ¶ added in v0.2.0
func TemplateCardHorizontalContentMedia(filename string, media Media) TemplateCardHorizontalContentOption
func TemplateCardHorizontalContentText ¶ added in v0.2.0
func TemplateCardHorizontalContentText(text string) TemplateCardHorizontalContentOption
func TemplateCardHorizontalContentUrl ¶ added in v0.2.0
func TemplateCardHorizontalContentUrl(rawUrl string, text string) TemplateCardHorizontalContentOption
type TemplateCardImageOption ¶ added in v0.2.0
type TemplateCardImageOption func(img *templateCardImage)
func TemplateCardImage ¶ added in v0.2.0
func TemplateCardImage(rawUrl string, aspectRatio ...float64) TemplateCardImageOption
TemplateCardImage
aspectRatio 图片的宽高比 宽高比要小于2.25 大于1.3 不填该参数默认1.3
type TemplateCardJumpOption ¶ added in v0.2.0
type TemplateCardJumpOption func(j *templateCardJump)
func TemplateCardJumpApp ¶ added in v0.2.0
func TemplateCardJumpApp(appID string, pagePath string) TemplateCardJumpOption
func TemplateCardJumpUrl ¶ added in v0.2.0
func TemplateCardJumpUrl(rawUrl string) TemplateCardJumpOption
type TemplateCardMainTitleOption ¶ added in v0.2.0
type TemplateCardMainTitleOption func(mt *templateCardMainTitle)
func TemplateCardMainTitle ¶ added in v0.2.0
func TemplateCardMainTitle(title string, desc string) TemplateCardMainTitleOption
type TemplateCardOption ¶ added in v0.2.0
type TemplateCardOption func(tc *templateCard)
func TemplateCardEmphasisContent ¶ added in v0.2.0
func TemplateCardEmphasisContent(title, desc string) TemplateCardOption
func TemplateCardHorizontalContent ¶ added in v0.2.0
func TemplateCardHorizontalContent(keyName string, opt TemplateCardHorizontalContentOption) TemplateCardOption
TemplateCardHorizontalContent 二级标题+文本列表
列表长度不超过6
func TemplateCardJump ¶ added in v0.2.0
func TemplateCardJump(title string, opt TemplateCardJumpOption) TemplateCardOption
TemplateCardJump 跳转指引样式的列表
列表长度不超过3
func TemplateCardSource ¶ added in v0.2.0
func TemplateCardSource(iconUrl, desc string) TemplateCardOption
func TemplateCardSubTitleText ¶ added in v0.2.0
func TemplateCardSubTitleText(subTitle string) TemplateCardOption
func TemplateCardVerticalContent ¶ added in v0.2.0
func TemplateCardVerticalContent(title, desc string) TemplateCardOption
TemplateCardVerticalContent 卡片二级垂直内容
列表长度不超过4
type TextMsgOption ¶
type TextMsgOption func(d *textData)
func MentionAllByMobile ¶
func MentionAllByMobile() TextMsgOption
MentionAllByMobile `@all` 提醒所有人, 等同于 MentionAllByUserid
func MentionAllByUserid ¶
func MentionAllByUserid() TextMsgOption
MentionAllByUserid `@all` 提醒所有人, 等同于 MentionAllByMobile
func MentionByMobile ¶
func MentionByMobile(mobile string) TextMsgOption
MentionByMobile 通过 `手机号码` @某个成员
func MentionByUserid ¶
func MentionByUserid(userid string) TextMsgOption
MentionByUserid 通过 `userid` @某个成员
type WeComBot ¶
type WeComBot interface { PushTextMessage(content string, opts ...TextMsgOption) error PushMarkdownMessage(content string) error PushImageMessage(img []byte) error PushNewsMessage(art Article, articles ...Article) error PushFileMessage(media Media) error PushTemplateCardTextNotice(mainTitle TemplateCardMainTitleOption, cardAction TemplateCardAction, opts ...TemplateCardOption) error PushTemplateCardNewsNotice(mainTitle TemplateCardMainTitleOption, cardImage TemplateCardImageOption, cardAction TemplateCardAction, opts ...TemplateCardOption) error UploadFile(filename string) (media Media, err error) }
func NewWeComBot ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.