Documentation ¶
Index ¶
- Constants
- Variables
- func GenSign(secret string, timestamp int64) (string, error)
- func ValidMsgtype(msgtype string) bool
- type Card
- type CardConfig
- type CardHeader
- type Content
- type FeishuGroupBot
- func (bot *FeishuGroupBot) Addr() string
- func (bot *FeishuGroupBot) AddrForDownloadFile(fileKey string) string
- func (bot *FeishuGroupBot) AddrForFetchImage() string
- func (bot *FeishuGroupBot) AddrForUploadFile() string
- func (bot *FeishuGroupBot) AddrForUploadImage() string
- func (bot *FeishuGroupBot) DownloadFile(fileKey string) ([]byte, error)
- func (bot *FeishuGroupBot) FetchImage(imageKey string) ([]byte, error)
- func (bot *FeishuGroupBot) Send(msg *Msg) error
- func (bot *FeishuGroupBot) SendImage(imageKey string) error
- func (bot *FeishuGroupBot) UploadFile(filename string, filetype string, fileReader io.Reader) (fileKey string, err error)
- func (bot *FeishuGroupBot) UploadImage(filename string, fileReader io.Reader) (imageKey string, err error)
- type I18NElements
- type Line
- type Msg
- func NewMsgCard(card *Card) *Msg
- func NewMsgImage(imageKey string) *Msg
- func NewMsgImageFromPayload(payload *models.Payload) *Msg
- func NewMsgInteractiveFromPayload(payload *models.Payload) *Msg
- func NewMsgMarkdownFromPayload(payload *models.Payload) *Msg
- func NewMsgPost(title string, lines []*Line) *Msg
- func NewMsgPostFromPayload(payload *models.Payload) *Msg
- func NewMsgShareChat(shareChatID string) *Msg
- func NewMsgShareChatFromPayload(payload *models.Payload) *Msg
- func NewMsgText(text string) *Msg
- func NewMsgTextFromPayload(payload *models.Payload) *Msg
- type Post
- type Segment
- type Sender
- type ZHCN
Constants ¶
View Source
const ( MsgTypeText = "text" MsgTypeImage = "image" MsgTypePost = "post" MsgTypeInteractive = "interactive" // Underlying, we use interactive to implement markdown MsgTypeMarkdown = "markdown" )
View Source
const ChannelTypeFeishu = "feishu"
Variables ¶
View Source
var SupportedMsgtype = make(map[string]bool)
Functions ¶
func ValidMsgtype ¶
Types ¶
type Card ¶
type Card struct { Config *CardConfig `json:"config,omitempty"` Header *CardHeader `json:"header,omitempty"` CardLink *card.MultiURL `json:"card_link,omitempty"` Elements []card.CardModule `json:"elements"` // 最多可堆叠 50 个模块 I18NElements *I18NElements `json:"i18n_elements,omitempty"` }
func NewCardMarkdown ¶
type CardConfig ¶
type CardConfig struct { WideScreenMode bool `json:"wide_screen_mode,omitempty"` // 2021/03/22 之后,此字段废弃,所有卡片均升级为自适应屏幕宽度的宽版卡片 EnableForward bool `json:"enable_forward"` // 是否允许卡片被转发,默认 false }
CardConfig 卡片配置
type CardHeader ¶
type CardHeader struct { Title *card.Text `json:"title"` // 卡片标题内容, text 对象(仅支持 "plain_text") Template string `json:"template,omitempty"` // 控制标题背景颜色, https://open.feishu.cn/document/ukTMukTMukTM/ukTNwUjL5UDM14SO1ATN }
type FeishuGroupBot ¶
type FeishuGroupBot struct {
// contains filtered or unexported fields
}
FeishuBot can send messages to feishu group ref: https://www.feishu.cn/hc/zh-CN/articles/360024984973
func NewFeishuGroupBot ¶
func NewFeishuGroupBot(token string) *FeishuGroupBot
func (*FeishuGroupBot) Addr ¶
func (bot *FeishuGroupBot) Addr() string
func (*FeishuGroupBot) AddrForDownloadFile ¶
func (bot *FeishuGroupBot) AddrForDownloadFile(fileKey string) string
func (*FeishuGroupBot) AddrForFetchImage ¶
func (bot *FeishuGroupBot) AddrForFetchImage() string
func (*FeishuGroupBot) AddrForUploadFile ¶
func (bot *FeishuGroupBot) AddrForUploadFile() string
func (*FeishuGroupBot) AddrForUploadImage ¶
func (bot *FeishuGroupBot) AddrForUploadImage() string
func (*FeishuGroupBot) DownloadFile ¶
func (bot *FeishuGroupBot) DownloadFile(fileKey string) ([]byte, error)
func (*FeishuGroupBot) FetchImage ¶
func (bot *FeishuGroupBot) FetchImage(imageKey string) ([]byte, error)
func (*FeishuGroupBot) Send ¶
func (bot *FeishuGroupBot) Send(msg *Msg) error
func (*FeishuGroupBot) SendImage ¶
func (bot *FeishuGroupBot) SendImage(imageKey string) error
func (*FeishuGroupBot) UploadFile ¶
func (*FeishuGroupBot) UploadImage ¶
type I18NElements ¶
type I18NElements struct { ZHCN []card.CardModule `json:"zh_cn"` ENUS []card.CardModule `json:"en_us"` JAJP []card.CardModule `json:"jn_jp"` }
type Msg ¶
type Msg struct { MsgType string `json:"msg_type"` Content *Content `json:"content,omitempty"` Card *Card `json:"card,omitempty"` RootID string `json:"root_id,omitempty"` // 需要回复的消息的open_message_id UpdateMulti bool `json:"update_multi,omitempty"` // 控制卡片是否是共享卡片(所有用户共享同一张消息卡片),默认为 false }
func NewMsgCard ¶
func NewMsgImage ¶
func NewMsgImageFromPayload ¶
func NewMsgPost ¶
func NewMsgPostFromPayload ¶
func NewMsgShareChat ¶
func NewMsgText ¶
func NewMsgTextFromPayload ¶
type Segment ¶
type Segment struct { Tag string `json:"tag"` // text, img, a, at UnEscape bool `json:"un_escape"` Text string `json:"text"` Href string `json:"href"` UserID string `json:"user_id"` ImageKey string `json:"image_key"` Height int `json:"height"` Width int `json:"width"` }
func NewSegmentAt ¶
func NewSegmentText ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.