bot

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MsgTypeText        = "text"        // 文本
	MsgTypePost        = "post"        // 富文本
	MsgTypeImage       = "image"       // 图片
	MsgTypeShareChat   = "share_chat"  // 分享群名片
	MsgTypeInteractive = "interactive" // 消息卡片
)

Variables

This section is empty.

Functions

func CmdSend

func CmdSend(arg *CmdSendParams) error

CmdSend 发送飞书自定义机器人消息

func Send

func Send(accessToken string, msg *Message) error

Send 发送飞书自定义机器人消息

func ValidateMsgType

func ValidateMsgType(v string) error

ValidateMsgType 验证

Types

type CardElement

type CardElement struct {
	Tag     string              `json:"tag"`
	Text    CardElementText     `json:"text,omitempty"`
	Actions []CardElementAction `json:"actions,omitempty"`
}

type CardElementAction

type CardElementAction struct {
	Tag   string                `json:"tag"`
	Text  CardElementActionText `json:"text"`
	Url   string                `json:"url"`
	Type  string                `json:"type"`
	Value struct {
	} `json:"value"`
}

type CardElementActionText

type CardElementActionText struct {
	Content string `json:"content"`
	Tag     string `json:"tag"`
}

type CardElementText

type CardElementText struct {
	Content string `json:"content"`
	Tag     string `json:"tag"`
}

type CardHeader

type CardHeader struct {
	Title CardHeaderTitle `json:"title"`
}

type CardHeaderTitle

type CardHeaderTitle struct {
	Content string `json:"content"`
	Tag     string `json:"tag"`
}

type CardMeta

type CardMeta struct {
	Elements []CardElement `json:"elements"`
	Header   CardHeader    `json:"header"`
}

CardMeta 消息卡片

type CmdSendParams

type CmdSendParams struct {
	UserAgent   string
	AccessToken string
	Secret      string
	MsgType     string
	Data        string
}

func (*CmdSendParams) Validate

func (t *CmdSendParams) Validate() error

type ContentMeta

type ContentMeta struct {
	Text        string    `json:"text,omitempty"`          // 文本
	ImageKey    string    `json:"image_key,omitempty"`     // 图片
	ShareChatID string    `json:"share_chat_id,omitempty"` // 分享群名片
	Post        *PostMeta `json:"post,omitempty"`          // 富文本
}

type Message

type Message struct {
	MsgType   string       `json:"msg_type"`            // 消息类型
	TimeStamp string       `json:"timestamp,omitempty"` // 为距当前时间不超过 1 小时(3600)的时间戳,时间单位s
	Sign      string       `json:"sign,omitempty"`      // 签名
	Content   *ContentMeta `json:"content,omitempty"`   // 消息内容
	Card      *CardMeta    `json:"card,omitempty"`      // 消息卡片
}

Message 飞书自定义机器人消息

type PostMeta

type PostMeta struct {
	ZhCn PostZhCn `json:"zh_cn"`
}

PostMeta 富文本

type PostZhCn

type PostZhCn struct {
	Title   string              `json:"title"`
	Content [][]PostZhCnContent `json:"content"`
}

type PostZhCnContent

type PostZhCnContent struct {
	Tag       string `json:"tag"`
	Text      string `json:"text,omitempty"`
	Href      string `json:"href,omitempty"`
	UserId    string `json:"user_id,omitempty"`
	UserName  string `json:"user_name,omitempty"`
	ImageKey  string `json:"image_key,omitempty"`
	FileKey   string `json:"file_key,omitempty"`
	EmojiType string `json:"emoji_type,omitempty"`
}

Jump to

Keyboard shortcuts

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