Documentation ¶
Overview ¶
Package notifies 包含了内置通知内容的实现
Index ¶
- Constants
- type FeiShu
- type FeiShuMessage
- func FeiShuMessageWithAudio(fileKey string) FeiShuMessage
- func FeiShuMessageWithFile(fileKey string) FeiShuMessage
- func FeiShuMessageWithImage(imageKey string) FeiShuMessage
- func FeiShuMessageWithInteractive(json string) FeiShuMessage
- func FeiShuMessageWithMedia(fileKey string) FeiShuMessage
- func FeiShuMessageWithMediaAndCover(fileKey, imageKey string) FeiShuMessage
- func FeiShuMessageWithRichText(richText *FeiShuRichText) FeiShuMessage
- func FeiShuMessageWithShareChat(chatId string) FeiShuMessage
- func FeiShuMessageWithShareUser(userId string) FeiShuMessage
- func FeiShuMessageWithSticker(fileKey string) FeiShuMessage
- func FeiShuMessageWithText(text string) FeiShuMessage
- type FeiShuRichText
- type FeiShuRichTextContent
- func (slf *FeiShuRichTextContent) AddAt(userId string, styles ...string) *FeiShuRichTextContent
- func (slf *FeiShuRichTextContent) AddAtWithUsername(userId, username string, styles ...string) *FeiShuRichTextContent
- func (slf *FeiShuRichTextContent) AddEmotion(emojiType string) *FeiShuRichTextContent
- func (slf *FeiShuRichTextContent) AddImg(imageKey string) *FeiShuRichTextContent
- func (slf *FeiShuRichTextContent) AddLink(text, href string, styles ...string) *FeiShuRichTextContent
- func (slf *FeiShuRichTextContent) AddMedia(fileKey string) *FeiShuRichTextContent
- func (slf *FeiShuRichTextContent) AddMediaWithCover(fileKey, imageKey string) *FeiShuRichTextContent
- func (slf *FeiShuRichTextContent) AddText(text string, styles ...string) *FeiShuRichTextContent
- func (slf *FeiShuRichTextContent) AddUnescapeText(text string, styles ...string) *FeiShuRichTextContent
- func (slf *FeiShuRichTextContent) Ok() *FeiShuRichText
Constants ¶
const ( FeiShuMsgTypeText = "text" // 文本 FeiShuMsgTypeRichText = "post" // 富文本 FeiShuMsgTypeImage = "image" // 图片 FeiShuMsgTypeInteractive = "interactive" // 消息卡片 FeiShuMsgTypeAudio = "audio" // 音频 FeiShuMsgTypeMedia = "media" // 视频 FeiShuMsgTypeFile = "file" // 文件 FeiShuMsgTypeSticker = "sticker" // 表情包 )
const ( FeiShuStyleBold = "bold" // 加粗 FeiShuStyleUnderline = "underline" // 下划线 FeiShuStyleLineThrough = "lineThrough" // 删除线 FeiShuStyleItalic = "italic" // 斜体 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FeiShuMessage ¶
type FeiShuMessage func(feishu *FeiShu)
func FeiShuMessageWithAudio ¶
func FeiShuMessageWithAudio(fileKey string) FeiShuMessage
FeiShuMessageWithAudio 飞书语音消息
- fileKey 语音文件Key,可通过上传文件接口获取
上传文件:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/file/create
func FeiShuMessageWithFile ¶
func FeiShuMessageWithFile(fileKey string) FeiShuMessage
FeiShuMessageWithFile 飞书文件消息
- fileKey 文件Key,可通过上传文件接口获取
上传文件:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/file/create
func FeiShuMessageWithImage ¶
func FeiShuMessageWithImage(imageKey string) FeiShuMessage
FeiShuMessageWithImage 飞书图片消息
- imageKey 可通过上传图片接口获取
func FeiShuMessageWithInteractive ¶
func FeiShuMessageWithInteractive(json string) FeiShuMessage
FeiShuMessageWithInteractive 飞书卡片消息
- json 表示卡片的 json 数据或者消息模板的 json 数据
func FeiShuMessageWithMedia ¶
func FeiShuMessageWithMedia(fileKey string) FeiShuMessage
FeiShuMessageWithMedia 飞书视频消息
- fileKey 视频文件Key,可通过上传文件接口获取
上传文件:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/file/create
func FeiShuMessageWithMediaAndCover ¶
func FeiShuMessageWithMediaAndCover(fileKey, imageKey string) FeiShuMessage
FeiShuMessageWithMediaAndCover 飞书带封面的视频消息
- fileKey 视频文件Key,可通过上传文件接口获取
- imageKey 图片文件Key,可通过上传文件接口获取
上传文件:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/file/create
func FeiShuMessageWithRichText ¶
func FeiShuMessageWithRichText(richText *FeiShuRichText) FeiShuMessage
FeiShuMessageWithRichText 飞书富文本消息
func FeiShuMessageWithShareChat ¶
func FeiShuMessageWithShareChat(chatId string) FeiShuMessage
FeiShuMessageWithShareChat 飞书分享群名片
- chatId 群ID获取方式请参见群ID说明
群ID说明:https://open.feishu.cn/document/server-docs/group/chat/chat-id-description
func FeiShuMessageWithShareUser ¶
func FeiShuMessageWithShareUser(userId string) FeiShuMessage
FeiShuMessageWithShareUser 飞书分享个人名片
- userId 表示用户的 OpenID 获取方式请参见了解更多:如何获取 Open ID
如何获取 Open ID:https://open.feishu.cn/document/faq/trouble-shooting/how-to-obtain-openid
func FeiShuMessageWithSticker ¶
func FeiShuMessageWithSticker(fileKey string) FeiShuMessage
FeiShuMessageWithSticker 飞书表情包消息
- fileKey 表情包文件Key,目前仅支持发送机器人收到的表情包,可通过接收消息事件的推送获取表情包 file_key。
接收消息事件:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/events/receive
func FeiShuMessageWithText ¶
func FeiShuMessageWithText(text string) FeiShuMessage
FeiShuMessageWithText 飞书文本消息
- 支持通过换行符进行消息换行
- 支持通过 <at user_id="OpenID">名字</at> 进行@用户
- 支持通过 <at user_id="all">所有人</at> 进行@所有人(必须满足所在群开启@所有人功能。)
支持加粗、斜体、下划线、删除线四种样式,可嵌套使用:
- 加粗: <b>文本示例</b>
- 斜体: <i>文本示例</i>
- 下划线 : <u>文本示例</u>
- 删除线: <s>文本示例</s>
超链接使用说明
- 超链接的使用格式为[文本](链接), 如[Feishu Open Platform](https://open.feishu.cn) 。
- 请确保链接是合法的,否则会以原始内容发送消息。
type FeiShuRichText ¶
type FeiShuRichText struct {
// contains filtered or unexported fields
}
FeiShuRichText 飞书富文本结构
func (*FeiShuRichText) Create ¶
func (slf *FeiShuRichText) Create(lang, title string) *FeiShuRichTextContent
Create 创建一个特定语言和标题的富文本内容
type FeiShuRichTextContent ¶
type FeiShuRichTextContent struct { Title string `json:"title,omitempty"` Content [][]map[string]any `json:"content,omitempty"` // contains filtered or unexported fields }
FeiShuRichTextContent 飞书富文本内容体
func (*FeiShuRichTextContent) AddAt ¶
func (slf *FeiShuRichTextContent) AddAt(userId string, styles ...string) *FeiShuRichTextContent
AddAt 添加@的用户
- @单个用户时,userId 字段必须是有效值
- @所有人填"all"。
func (*FeiShuRichTextContent) AddAtWithUsername ¶
func (slf *FeiShuRichTextContent) AddAtWithUsername(userId, username string, styles ...string) *FeiShuRichTextContent
AddAtWithUsername 添加包含用户名的@用户
- @单个用户时,userId 字段必须是有效值
- @所有人填"all"。
func (*FeiShuRichTextContent) AddEmotion ¶
func (slf *FeiShuRichTextContent) AddEmotion(emojiType string) *FeiShuRichTextContent
AddEmotion 添加表情
- emojiType 表示表情类型,部分可选值请参见表情文案。
表情文案:https://open.feishu.cn/document/server-docs/im-v1/message-reaction/emojis-introduce
func (*FeiShuRichTextContent) AddImg ¶
func (slf *FeiShuRichTextContent) AddImg(imageKey string) *FeiShuRichTextContent
AddImg 添加图片
- imageKey 表示图片的唯一标识,可通过上传图片接口获取
func (*FeiShuRichTextContent) AddLink ¶
func (slf *FeiShuRichTextContent) AddLink(text, href string, styles ...string) *FeiShuRichTextContent
AddLink 添加超链接文本
- 请确保链接地址的合法性,否则消息会发送失败
func (*FeiShuRichTextContent) AddMedia ¶
func (slf *FeiShuRichTextContent) AddMedia(fileKey string) *FeiShuRichTextContent
AddMedia 添加视频
- fileKey 表示视频文件的唯一标识,可通过上传文件接口获取
func (*FeiShuRichTextContent) AddMediaWithCover ¶
func (slf *FeiShuRichTextContent) AddMediaWithCover(fileKey, imageKey string) *FeiShuRichTextContent
AddMediaWithCover 添加包含封面的视频
- fileKey 表示视频文件的唯一标识,可通过上传文件接口获取
- imageKey 表示图片的唯一标识,可通过上传图片接口获取
func (*FeiShuRichTextContent) AddText ¶
func (slf *FeiShuRichTextContent) AddText(text string, styles ...string) *FeiShuRichTextContent
AddText 添加文本
func (*FeiShuRichTextContent) AddUnescapeText ¶
func (slf *FeiShuRichTextContent) AddUnescapeText(text string, styles ...string) *FeiShuRichTextContent
AddUnescapeText 添加 unescape 解码的文本
func (*FeiShuRichTextContent) Ok ¶
func (slf *FeiShuRichTextContent) Ok() *FeiShuRichText
Ok 确认完成,将返回 FeiShuRichText 可继续创建多语言富文本