workwxrobot

package
v1.3.4-beta6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessToken

type AccessToken struct {
	AccessToken string `json:"access_token"`
	ExpiresIn   int    `json:"expires_in"`
	Err
	ExpiresInTime time.Time
}

AccessToken 微信企业号请求Token

type Article

type Article struct {
	Title       string `json:"title"`
	Description string `json:"description"`
	Url         string `json:"url"`
	Picurl      string `json:"picurl"`
}

type BotImage

type BotImage struct {
	Base64 string `json:"base64"`
	Md5    string `json:"md5"`
}

type BotMarkDown

type BotMarkDown struct {
	Content string `json:"content"`
}

type BotMessage

type BotMessage struct {
	MsgType       string `json:"msgtype"` // text / textcard / markdown / link(<a href="">...<a/>)
	ProgramType   string `json:"program"`
	IsSendNow     bool   `json:"issendimmediately"`
	ConfigID      string `json:"configid"`
	Content       string `json:"content"`
	MentionedList string `json:"mentioned_list"`
}

BotMessage 机器人消息

type BotText

type BotText struct {
	Content             string   `json:"content"`
	MentionedList       []string `json:"mentioned_list,omitempty"`
	MentionedMobileList []string `json:"mentioned_mobile_list,omitempty"`
}

type Client

type Client struct {
	CropID      string
	AgentID     int64
	AgentSecret string
	Token       AccessToken
}

Client 微信企业号应用配置信息

type Content

type Content struct {
	Content string `json:"content"`
}

Content 文本消息内容

type Err

type Err struct {
	ErrCode int    `json:"errcode"`
	ErrMsg  string `json:"errmsg"`
}

Err 微信返回错误

type Media

type Media struct {
	MediaID     string `json:"media_id"`
	Title       string `json:"title,omitempty"`       // 视频参数
	Description string `json:"description,omitempty"` // 视频参数
}

Media 媒体内容

type Message

type Message struct {
	ToUser  string `json:"touser"`
	ToParty string `json:"toparty"`
	ToTag   string `json:"totag"`
	MsgType string `json:"msgtype"`
	AgentID int64  `json:"agentid"`

	Text     Content  `json:"text"`
	Image    Media    `json:"image"`
	Voice    Media    `json:"voice"`
	Video    Media    `json:"video"`
	File     Media    `json:"file"`
	Textcard TextCard `json:"textcard"`
	News     News     `json:"news"`
	MpNews   MpNews   `json:"mpnews"`
	Markdown Content  `json:"markdown"`
	Taskcard TaskCard `json:"taskcard"`
}

Message 消息主体参数 https://work.weixin.qq.com/api/doc/90000/90135/90236

type MpArticle

type MpArticle struct {
	Title            string `json:"title"`
	ThumbMediaID     string `json:"thumb_media_id"`
	Author           string `json:"author"`
	ContentSourceUrl string `json:"content_source_url"`
	Content          string `json:"content"`
	Digest           string `json:"digest"`
}

type MpNews

type MpNews struct {
	Articles []MpArticle `json:"articles"`
}

mpnews 图文

type News

type News struct {
	Articles []Article `json:"articles"`
}

news 图文

type Result

type Result struct {
	Err
	InvalidUser  string `json:"invaliduser"`
	InvalidParty string `json:"infvalidparty"`
	InvalidTag   string `json:"invalidtag"`
}

Result 发送消息返回结果

type Robot

type Robot struct {
	Webhook string
}

Robot represents a workwxbot custom robot that can send messages to groups.

func (Robot) Send

func (r Robot) Send(msg interface{}) error

SendMarkdown send a markdown type message.

type Roboter

type Roboter interface {
	Send(interface{}) error
}

Roboter is the interface implemented by Robot that can send multiple types of messages.

func NewRobot

func NewRobot(webhook string) Roboter

NewRobot returns a roboter that can send messages.

type TaskBtn

type TaskBtn struct {
	Key         string `json:"key"`
	Name        string `json:"name"`
	ReplaceName string `json:"replace_name"`
	Color       string `json:"color"`
	IsBold      bool   `json:"is_bold"`
}

type TaskCard

type TaskCard struct {
	Title       string    `json:"title"`
	Description string    `json:"description"`
	Url         string    `json:"url"`
	TaskID      string    `json:"task_id"`
	Btn         []TaskBtn `json:"btn"`
}

任务卡片

type TextCard

type TextCard struct {
	Title       string `json:"title"`
	Description string `json:"description"`
	Url         string `json:"url"`
	Btntxt      string `json:"btntxt"`
}

Card 卡片

type WxBotMessage

type WxBotMessage struct {
	MsgType  string      `json:"msgtype"`
	BotText  BotText     `json:"text"`
	MarkDown BotMarkDown `json:"markdown"`
	Image    BotImage    `json:"image"`
	News     News        `json:"news"`
	File     Media       `json:"file"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL