Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNeedToken = errors.New("wx: need token") // 需要提供令牌
)
预定义错误
Functions ¶
This section is empty.
Types ¶
type BotClient ¶
type BotClient struct {
Client *http.Client // 底层 http client。不填则使用默认值。
Logger *slog.Logger // 日志 logger。不填则使用默认值。
BaseURL string // 接口基础地址。不填则使用默认值。
Key string // 机器人令牌。
}
企业微信机器人客户端
func (BotClient) SendMarkdown ¶
发送 Markdown 信息。
type MarkdownMessage ¶
type MarkdownMessage struct {
Content string `json:"content"` // 是 markdown内容,最长不超过4096个字节,必须是utf8编码
}
markdown 信息
type Message ¶
type Message struct {
MsgType MessageType `json:"msgtype"` // 信息类型
Text *TextMessage `json:"text,omitempty"` // 文本信息
Markdown *MarkdownMessage `json:"markdown,omitempty"` // markdown 信息
}
信息
type MessageType ¶
type MessageType = string
信息类型
const ( MessageTypeText MessageType = "text" // 文本信息类型 MessageTypeMarkdown MessageType = "markdown" // markdown 信息类型 )
type SendResponse ¶
type SendResponse struct {
ErrCode int `json:"errcode"` // 错误码
ErrMsg string `json:"errmsg"` // 错误说明
}
发送响应
type TextMessage ¶
type TextMessage struct {
Content string `json:"content"` // 是 文本内容,最长不超过2048个字节,必须是utf8编码
MentionedList []string `json:"mentioned_list,omitempty"` // 否 user id 的列表,提醒群中的指定成员(@某个成员),@all 表示提醒所有人,如果开发者获取不到 user id,可以使用 mentioned_mobile_list
MentionedMobileList []string `json:"mentioned_mobile_list,omitempty"` // 否 手机号列表,提醒手机号对应的群成员(@某个成员),@all 表示提醒所有人
}
文本信息
Click to show internal directories.
Click to hide internal directories.