Documentation ¶
Index ¶
- func TextAtEveryone() string
- func TextAtPerson(id, name string) string
- type Bot
- type BotOptions
- func (opts *BotOptions) SetBaseURL(s string) *BotOptions
- func (opts *BotOptions) SetHookAfterMessageApply(f func(body *MessageBody) error) *BotOptions
- func (opts *BotOptions) SetLimiterPerMinute(n int) *BotOptions
- func (opts *BotOptions) SetLimiterPerSecond(n int) *BotOptions
- func (opts *BotOptions) SetSecretKey(s string) *BotOptions
- type CardBuilder
- type CardElement
- type CardElementAction
- type CardElementActionButton
- func (e *CardElementActionButton) ActionEntity() any
- func (e *CardElementActionButton) Confirm(title, text string) *CardElementActionButton
- func (e *CardElementActionButton) MultiURL(defaultURL, pc, ios, android string) *CardElementActionButton
- func (e *CardElementActionButton) Type(typ CardElementActionButtonType) *CardElementActionButton
- func (e *CardElementActionButton) URL(s string) *CardElementActionButton
- type CardElementActionButtonType
- type CardElementActionComponent
- type CardElementActionLayout
- type CardElementActionOverflow
- func (e *CardElementActionOverflow) ActionEntity() any
- func (e *CardElementActionOverflow) AddOptionWithMultiURL(text, defaultURL, pc, ios, android string) *CardElementActionOverflow
- func (e *CardElementActionOverflow) AddOptionWithURL(text, defaultURL string) *CardElementActionOverflow
- func (e *CardElementActionOverflow) Confirm(title, text string) *CardElementActionOverflow
- type CardElementColumnSet
- func (e *CardElementColumnSet) ActionMultiURL(defaultURL, pc, ios, android string) *CardElementColumnSet
- func (e *CardElementColumnSet) BackgroundStyle(bs CardElementColumnSetBackgroundStyle) *CardElementColumnSet
- func (e *CardElementColumnSet) Columns(columns []*CardElementColumnSetColumn) *CardElementColumnSet
- func (e *CardElementColumnSet) Entity() any
- func (e *CardElementColumnSet) FlexMode(mode CardElementColumnSetFlexMode) *CardElementColumnSet
- func (e *CardElementColumnSet) HorizontalSpacing(hs CardElementColumnSetHorizontalSpacing) *CardElementColumnSet
- type CardElementColumnSetBackgroundStyle
- type CardElementColumnSetColumn
- func (e *CardElementColumnSetColumn) Elements(elements []CardElement) *CardElementColumnSetColumn
- func (e *CardElementColumnSetColumn) VerticalAlign(va CardElementColumnSetColumnVerticalAlign) *CardElementColumnSetColumn
- func (e *CardElementColumnSetColumn) Weight(n int) *CardElementColumnSetColumn
- func (e *CardElementColumnSetColumn) Width(width CardElementColumnSetColumnWidth) *CardElementColumnSetColumn
- type CardElementColumnSetColumnVerticalAlign
- type CardElementColumnSetColumnWidth
- type CardElementColumnSetFlexMode
- type CardElementColumnSetHorizontalSpacing
- type CardElementDiv
- func (e *CardElementDiv) Entity() any
- func (e *CardElementDiv) ExtraAction(component CardElementActionComponent) *CardElementDiv
- func (e *CardElementDiv) ExtraImage(imgKey string, preview bool, altContent string) *CardElementDiv
- func (e *CardElementDiv) Fields(fields []CardElementDivFieldText) *CardElementDiv
- func (e *CardElementDiv) LarkMarkdown(content string) *CardElementDiv
- func (e *CardElementDiv) PlainText(content string, lines int) *CardElementDiv
- type CardElementDivFieldText
- type CardElementDivTextMode
- type CardElementHorizontalRule
- type CardElementImage
- func (e *CardElementImage) CompactWidth(b bool) *CardElementImage
- func (e *CardElementImage) CustomWidth(px int) *CardElementImage
- func (e *CardElementImage) Entity() any
- func (e *CardElementImage) Mode(mode CardElementImageMode) *CardElementImage
- func (e *CardElementImage) Preview(b bool) *CardElementImage
- func (e *CardElementImage) TitleWithLarkMarkdown(title string) *CardElementImage
- func (e *CardElementImage) TitleWithPlainText(title string) *CardElementImage
- type CardElementImageMode
- type CardElementMarkdown
- func (e *CardElementMarkdown) Content(content string) *CardElementMarkdown
- func (e *CardElementMarkdown) Entity() any
- func (e *CardElementMarkdown) Href(defaultURL, pc, ios, android string) *CardElementMarkdown
- func (e *CardElementMarkdown) TextAlign(textAlign CardElementMarkdownTextAlign) *CardElementMarkdown
- type CardElementMarkdownTextAlign
- type CardElementNote
- func (e *CardElementNote) AddElementWithImage(imgKey string, preview bool, altContent string) *CardElementNote
- func (e *CardElementNote) AddElementWithLarkMarkdown(s string) *CardElementNote
- func (e *CardElementNote) AddElementWithPlainText(s string) *CardElementNote
- func (e *CardElementNote) Entity() any
- type CardGlobalConfig
- func (gConf *CardGlobalConfig) CardLink(defaultURL, pc, ios, android string) *CardGlobalConfig
- func (gConf *CardGlobalConfig) ConfigEnableForward(b bool) *CardGlobalConfig
- func (gConf *CardGlobalConfig) ConfigUpdateMulti(b bool) *CardGlobalConfig
- func (gConf *CardGlobalConfig) HeaderIcon(imgKey string) *CardGlobalConfig
- func (gConf *CardGlobalConfig) HeaderTemplate(template CardHeaderTemplate) *CardGlobalConfig
- type CardHeaderTemplate
- type CardHeaderTextTag
- type CardHeaderTextTagColor
- type Language
- type Message
- type MessageBody
- type MessageBodyCard
- type MessageBodyCardTemplate
- type MessageBodyCardTemplateData
- type MessageBodyContent
- type RichTextBuilder
- func (rtb *RichTextBuilder) At(id, name string) *RichTextBuilder
- func (rtb *RichTextBuilder) AtEveryone() *RichTextBuilder
- func (rtb *RichTextBuilder) Hyperlink(text, href string) *RichTextBuilder
- func (rtb *RichTextBuilder) Image(imgKey string) *RichTextBuilder
- func (rtb *RichTextBuilder) Text(text string, unEscape bool) *RichTextBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TextAtPerson ¶
TextAtPerson @指定人
可填入用户的 Open ID 或 User ID,且必须是有效值(仅支持 @ 自定义机器人所在群的群成员),否则取名字展示,并不产生实际的 @ 效果
https://open.feishu.cn/document/client-docs/bot-v3/add-custom-bot?lang=zh-CN#756b882f https://open.feishu.cn/document/client-docs/bot-v3/add-custom-bot?lang=zh-CN#272b1dee
Types ¶
type Bot ¶
type Bot interface { // SendText 发送文本消息 // // https://open.feishu.cn/document/client-docs/bot-v3/add-custom-bot?lang=zh-CN#756b882f // // @指定人: TextAtPerson // @所有人: TextAtEveryone SendText(content string) error // SendRichText 发送富文本消息 // // https://open.feishu.cn/document/client-docs/bot-v3/add-custom-bot?lang=zh-CN#f62e72d5 SendRichText(rt *RichTextBuilder, multiLanguage ...*RichTextBuilder) error // SendGroupBusinessCard 发送群名片 // // https://open.feishu.cn/document/client-docs/bot-v3/add-custom-bot?lang=zh-CN#897b5321 // // 群 ID 获取方式: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/chat-id-description SendGroupBusinessCard(chatID string) error // SendImage 发送图片 // // https://open.feishu.cn/document/client-docs/bot-v3/add-custom-bot?lang=zh-CN#132a114c // // image_key 获取方式: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/image/create SendImage(imgKey string) error // SendCard 发送消息卡片 // // https://open.feishu.cn/document/client-docs/bot-v3/add-custom-bot?lang=zh-CN#4996824a SendCard(globalConf *CardGlobalConfig, card *CardBuilder, multiLanguage ...*CardBuilder) error // SendCardViaTemplate 使用卡片 ID 发送消息 // // https://open.feishu.cn/document/ukTMukTMukTM/uYzM3QjL2MzN04iNzcDN/send-message-card/send-message-using-card-id SendCardViaTemplate(id string, variables any) error SendMessage(msg Message) error }
func NewBot ¶
func NewBot(webhook string, opts *BotOptions) Bot
type BotOptions ¶
type BotOptions struct { BaseURL string LimiterPerSecond, LimiterPerMinute int SecretKey string HookAfterMessageApply func(body *MessageBody) error }
func NewBotOptions ¶
func NewBotOptions() *BotOptions
func (*BotOptions) SetBaseURL ¶
func (opts *BotOptions) SetBaseURL(s string) *BotOptions
func (*BotOptions) SetHookAfterMessageApply ¶ added in v2.1.0
func (opts *BotOptions) SetHookAfterMessageApply(f func(body *MessageBody) error) *BotOptions
func (*BotOptions) SetLimiterPerMinute ¶
func (opts *BotOptions) SetLimiterPerMinute(n int) *BotOptions
func (*BotOptions) SetLimiterPerSecond ¶
func (opts *BotOptions) SetLimiterPerSecond(n int) *BotOptions
func (*BotOptions) SetSecretKey ¶
func (opts *BotOptions) SetSecretKey(s string) *BotOptions
type CardBuilder ¶
type CardBuilder struct {
// contains filtered or unexported fields
}
func NewCard ¶
func NewCard(language Language, title string) *CardBuilder
func (*CardBuilder) Elements ¶
func (cb *CardBuilder) Elements(elements []CardElement) *CardBuilder
Elements 卡片的正文内容
func (*CardBuilder) HeaderSubtitle ¶
func (cb *CardBuilder) HeaderSubtitle(subtitle string) *CardBuilder
HeaderSubtitle 卡片的副标题信息
func (*CardBuilder) HeaderTextTags ¶
func (cb *CardBuilder) HeaderTextTags(tags []CardHeaderTextTag) *CardBuilder
HeaderTextTags 标题的标签属性
最多可配置 3 个标签内容,如果配置的标签数量超过 3 个,则取前 3 个标签进行展示。 标签展示顺序与数组顺序一致
type CardElement ¶
type CardElement interface {
Entity() any
}
func NewCardElementHorizontalRule ¶
func NewCardElementHorizontalRule() CardElement
type CardElementAction ¶
type CardElementAction struct {
// contains filtered or unexported fields
}
CardElementAction 交互模块(action)
func NewCardElementAction ¶
func NewCardElementAction() *CardElementAction
func (*CardElementAction) Actions ¶
func (e *CardElementAction) Actions(actions []CardElementActionComponent) *CardElementAction
func (*CardElementAction) Entity ¶
func (e *CardElementAction) Entity() any
func (*CardElementAction) Layout ¶
func (e *CardElementAction) Layout(layout CardElementActionLayout) *CardElementAction
Layout 设置窄屏自适应布局方式
- bisected:二等分布局,每行两列交互元素
- trisection:三等分布局,每行三列交互元素
- flow:流式布局,元素会按自身大小横向排列并在空间不够的时候折行
type CardElementActionButton ¶
type CardElementActionButton struct {
// contains filtered or unexported fields
}
CardElementActionButton
func NewCardElementActionButton ¶
func NewCardElementActionButton(mode CardElementDivTextMode, content string) *CardElementActionButton
func (*CardElementActionButton) ActionEntity ¶
func (e *CardElementActionButton) ActionEntity() any
func (*CardElementActionButton) Confirm ¶
func (e *CardElementActionButton) Confirm(title, text string) *CardElementActionButton
Confirm 设置二次确认弹框
func (*CardElementActionButton) MultiURL ¶
func (e *CardElementActionButton) MultiURL(defaultURL, pc, ios, android string) *CardElementActionButton
MultiURL 基于 url 元素配置多端跳转链接,不可与 URL 同时设置
func (*CardElementActionButton) Type ¶
func (e *CardElementActionButton) Type(typ CardElementActionButtonType) *CardElementActionButton
Type 配置按钮样式
- default:默认样式
- primary:强调样式
- danger:警示样式
func (*CardElementActionButton) URL ¶
func (e *CardElementActionButton) URL(s string) *CardElementActionButton
URL 点击按钮后的跳转链接。不可与 MultiURL 同时设置
type CardElementActionButtonType ¶
type CardElementActionButtonType string
const ( CardElementActionButtonTypeDefault CardElementActionButtonType = "default" CardElementActionButtonTypePrimary CardElementActionButtonType = "primary" CardElementActionButtonTypeDanger CardElementActionButtonType = "danger" )
type CardElementActionComponent ¶
type CardElementActionComponent interface {
ActionEntity() any
}
type CardElementActionLayout ¶
type CardElementActionLayout string
const ( CardElementActionLayoutBisected CardElementActionLayout = "bisected" CardElementActionLayoutTrisection CardElementActionLayout = "trisection" CardElementActionLayoutFlow CardElementActionLayout = "flow" )
type CardElementActionOverflow ¶
type CardElementActionOverflow struct {
// contains filtered or unexported fields
}
CardElementActionOverflow 折叠按钮组(overflow)
func NewCardElementActionOverflow ¶
func NewCardElementActionOverflow() *CardElementActionOverflow
func (*CardElementActionOverflow) ActionEntity ¶
func (e *CardElementActionOverflow) ActionEntity() any
func (*CardElementActionOverflow) AddOptionWithMultiURL ¶
func (e *CardElementActionOverflow) AddOptionWithMultiURL(text, defaultURL, pc, ios, android string) *CardElementActionOverflow
AddOptionWithMultiURL 添加多端跳转链接的选项
func (*CardElementActionOverflow) AddOptionWithURL ¶
func (e *CardElementActionOverflow) AddOptionWithURL(text, defaultURL string) *CardElementActionOverflow
AddOptionWithURL 添加跳转链接的选项
func (*CardElementActionOverflow) Confirm ¶
func (e *CardElementActionOverflow) Confirm(title, text string) *CardElementActionOverflow
Confirm 设置二次确认弹框
type CardElementColumnSet ¶
type CardElementColumnSet struct {
// contains filtered or unexported fields
}
CardElementColumnSet 多列布局
https://open.feishu.cn/document/common-capabilities/message-card/message-cards-content/column-set
func NewCardElementColumnSet ¶
func NewCardElementColumnSet() *CardElementColumnSet
func (*CardElementColumnSet) ActionMultiURL ¶
func (e *CardElementColumnSet) ActionMultiURL(defaultURL, pc, ios, android string) *CardElementColumnSet
ActionMultiURL 设置点击布局容器时的交互配置。当前仅支持跳转交互。如果布局容器内有交互组件,则优先响应交互组件定义的交互
func (*CardElementColumnSet) BackgroundStyle ¶
func (e *CardElementColumnSet) BackgroundStyle(bs CardElementColumnSetBackgroundStyle) *CardElementColumnSet
BackgroundStyle 多列布局的背景色样式
- default:默认的白底样式,dark mode 下为黑底
- grey:灰底样式
当存在多列布局的嵌套时,上层多列布局的颜色覆盖下层多列布局的颜色
func (*CardElementColumnSet) Columns ¶
func (e *CardElementColumnSet) Columns(columns []*CardElementColumnSetColumn) *CardElementColumnSet
Columns 多列布局容器内,各个列容器的配置信息
func (*CardElementColumnSet) Entity ¶
func (e *CardElementColumnSet) Entity() any
func (*CardElementColumnSet) FlexMode ¶
func (e *CardElementColumnSet) FlexMode(mode CardElementColumnSetFlexMode) *CardElementColumnSet
FlexMode 移动端和 PC 端的窄屏幕下,各列的自适应方式
- none:不做布局上的自适应,在窄屏幕下按比例压缩列宽度
- stretch:列布局变为行布局,且每列(行)宽度强制拉伸为 100%,所有列自适应为上下堆叠排布
- flow:列流式排布(自动换行),当一行展示不下一列时,自动换至下一行展示
- bisect:两列等分布局
- trisect:三列等分布局
默认值:none
func (*CardElementColumnSet) HorizontalSpacing ¶
func (e *CardElementColumnSet) HorizontalSpacing(hs CardElementColumnSetHorizontalSpacing) *CardElementColumnSet
HorizontalSpacing 多列布局内,各列之间的水平分栏间距
- default:默认间距
- small:窄间距
type CardElementColumnSetBackgroundStyle ¶
type CardElementColumnSetBackgroundStyle string
const ( CardElementColumnSetBackgroundStyleDefault CardElementColumnSetBackgroundStyle = "default" CardElementColumnSetBackgroundStyleGrey CardElementColumnSetBackgroundStyle = "grey" )
type CardElementColumnSetColumn ¶
type CardElementColumnSetColumn struct {
// contains filtered or unexported fields
}
func NewCardElementColumnSetColumn ¶
func NewCardElementColumnSetColumn() *CardElementColumnSetColumn
func (*CardElementColumnSetColumn) Elements ¶
func (e *CardElementColumnSetColumn) Elements(elements []CardElement) *CardElementColumnSetColumn
func (*CardElementColumnSetColumn) VerticalAlign ¶
func (e *CardElementColumnSetColumn) VerticalAlign(va CardElementColumnSetColumnVerticalAlign) *CardElementColumnSetColumn
VerticalAlign 列内成员垂直对齐方式
- top:顶对齐
- center:居中对齐
- bottom:底部对齐
func (*CardElementColumnSetColumn) Weight ¶
func (e *CardElementColumnSetColumn) Weight(n int) *CardElementColumnSetColumn
Weight 当 width 取值 weighted 时生效,表示当前列的宽度占比。取值范围:1 ~ 5
func (*CardElementColumnSetColumn) Width ¶
func (e *CardElementColumnSetColumn) Width(width CardElementColumnSetColumnWidth) *CardElementColumnSetColumn
Width 列宽度属性
- auto:列宽度与列内元素宽度一致
- weighted:列宽度按 weight 参数定义的权重分布
type CardElementColumnSetColumnVerticalAlign ¶
type CardElementColumnSetColumnVerticalAlign string
const ( CardElementColumnSetColumnVerticalAlignTop CardElementColumnSetColumnVerticalAlign = "top" CardElementColumnSetColumnVerticalAlignCenter CardElementColumnSetColumnVerticalAlign = "center" CardElementColumnSetColumnVerticalAlignBottom CardElementColumnSetColumnVerticalAlign = "bottom" )
type CardElementColumnSetColumnWidth ¶
type CardElementColumnSetColumnWidth string
const ( CardElementColumnSetColumnWidthAuto CardElementColumnSetColumnWidth = "auto" CardElementColumnSetColumnWidthWeighted CardElementColumnSetColumnWidth = "weighted" )
type CardElementColumnSetFlexMode ¶
type CardElementColumnSetFlexMode string
const ( CardElementColumnSetFlexModeNone CardElementColumnSetFlexMode = "none" CardElementColumnSetFlexModeStretch CardElementColumnSetFlexMode = "stretch" CardElementColumnSetFlexModeFlow CardElementColumnSetFlexMode = "flow" CardElementColumnSetFlexModeBisect CardElementColumnSetFlexMode = "bisect" CardElementColumnSetFlexModeTrisect CardElementColumnSetFlexMode = "trisect" )
type CardElementColumnSetHorizontalSpacing ¶
type CardElementColumnSetHorizontalSpacing string
const ( CardElementColumnSetHorizontalSpacingDefault CardElementColumnSetHorizontalSpacing = "default" CardElementColumnSetHorizontalSpacingSmall CardElementColumnSetHorizontalSpacing = "small" )
type CardElementDiv ¶
type CardElementDiv struct {
// contains filtered or unexported fields
}
CardElementDiv
func NewCardElementDiv ¶
func NewCardElementDiv() *CardElementDiv
func (*CardElementDiv) Entity ¶
func (e *CardElementDiv) Entity() any
func (*CardElementDiv) ExtraAction ¶
func (e *CardElementDiv) ExtraAction(component CardElementActionComponent) *CardElementDiv
ExtraAction 在文本右侧附加交互组件
- NewCardElementActionButton
- NewCardElementActionOverflow
func (*CardElementDiv) ExtraImage ¶
func (e *CardElementDiv) ExtraImage(imgKey string, preview bool, altContent string) *CardElementDiv
ExtraImage 在文本右侧附加图片元素
preview: 点击后是否放大图片。在配置 card_link 后可设置为false,使用户点击卡片上的图片也能响应card_link链接跳转 altContent: 图片hover说明
func (*CardElementDiv) Fields ¶
func (e *CardElementDiv) Fields(fields []CardElementDivFieldText) *CardElementDiv
Fields 双列文本
func (*CardElementDiv) LarkMarkdown ¶
func (e *CardElementDiv) LarkMarkdown(content string) *CardElementDiv
LarkMarkdown 单个文本内容(支持部分 Markdown 语法的文本内容)
func (*CardElementDiv) PlainText ¶
func (e *CardElementDiv) PlainText(content string, lines int) *CardElementDiv
PlainText 单个文本内容(普通文本内容)
lines: 内容显示行数
type CardElementDivFieldText ¶
type CardElementDivFieldText struct { // 是否并排布局 // - true:并排 // - false:不并排 // // https://open.feishu.cn/document/common-capabilities/message-card/message-cards-content/embedded-non-interactive-elements/field#3827dadd IsShort bool // Mode // - CardElementDivTextModePlainText // - CardElementDivTextModeLarkMarkdown // // https://open.feishu.cn/document/common-capabilities/message-card/message-cards-content/embedded-non-interactive-elements/text#3827dadd Mode CardElementDivTextMode Content string // 内容显示行数 // // 该字段仅支持 plain_text 模式,不支持 lark_md 模式 // // https://open.feishu.cn/document/common-capabilities/message-card/message-cards-content/embedded-non-interactive-elements/text#3827dadd Lines int }
type CardElementDivTextMode ¶
type CardElementDivTextMode string
const ( CardElementDivTextModePlainText CardElementDivTextMode = "plain_text" CardElementDivTextModeLarkMarkdown CardElementDivTextMode = "lark_md" )
type CardElementHorizontalRule ¶
type CardElementHorizontalRule struct {
// contains filtered or unexported fields
}
CardElementHorizontalRule 分割线
func (*CardElementHorizontalRule) Entity ¶
func (e *CardElementHorizontalRule) Entity() any
type CardElementImage ¶
type CardElementImage struct {
// contains filtered or unexported fields
}
CardElementImage
func NewCardElementImage ¶
func NewCardElementImage(imgKey, altContent string) *CardElementImage
func (*CardElementImage) CompactWidth ¶
func (e *CardElementImage) CompactWidth(b bool) *CardElementImage
CompactWidth 是否展示为紧凑型的图片
默认值为 false。如果配置为 true,则展示最大宽度为 278px 的紧凑型图片
func (*CardElementImage) CustomWidth ¶
func (e *CardElementImage) CustomWidth(px int) *CardElementImage
CustomWidth 自定义图片的最大展示宽度,支持在 278px ~ 580px 范围内指定最大展示宽度
默认情况下图片宽度与图片组件所占区域的宽度一致
func (*CardElementImage) Entity ¶
func (e *CardElementImage) Entity() any
func (*CardElementImage) Mode ¶
func (e *CardElementImage) Mode(mode CardElementImageMode) *CardElementImage
Mode 图片显示模式
- crop_center:居中裁剪模式,对长图会限高,并居中裁剪后展示
- fit_horizontal:平铺模式,宽度撑满卡片完整展示上传的图片
- stretch:自适应。图片宽度撑满卡片宽度,当图片 高:宽 小于 16:9 时,完整展示原图。当图片 高:宽 大于 16:9 时,顶部对齐裁剪图片,并在图片底部展示 长图 脚标
- large:大图,尺寸为 160 × 160,适用于多图混排
- medium:中图,尺寸为 80 × 80,适用于图文混排的封面图
- small:小图,尺寸为 40 × 40,适用于人员头像
- tiny:超小图,尺寸为 16 × 16,适用于图标、备注
注意:设置该参数后,会覆盖 custom_width 参数。更多信息参见 消息卡片设计规范 https://open.feishu.cn/document/tools-and-resources/design-specification/message-card-design-specifications
func (*CardElementImage) Preview ¶
func (e *CardElementImage) Preview(b bool) *CardElementImage
Preview 点击后是否放大图片
默认值为 true,即点击后放大图片
如果你为卡片配置了 消息卡片跳转链接, 可将该参数设置为 false,后续用户点击卡片上的图片也能响应 card_link 链接跳转
func (*CardElementImage) TitleWithLarkMarkdown ¶
func (e *CardElementImage) TitleWithLarkMarkdown(title string) *CardElementImage
TitleWithLarkMarkdown 图片标题(lark_md)
func (*CardElementImage) TitleWithPlainText ¶
func (e *CardElementImage) TitleWithPlainText(title string) *CardElementImage
TitleWithPlainText 图片标题(plain_text)
type CardElementImageMode ¶
type CardElementImageMode string
const ( CardElementImageModeCropCenter CardElementImageMode = "crop_center" CardElementImageModeFitHorizontal CardElementImageMode = "fit_horizontal" CardElementImageModeStretch CardElementImageMode = "stretch" CardElementImageModeLarge CardElementImageMode = "large" CardElementImageModeMedium CardElementImageMode = "medium" CardElementImageModeSmall CardElementImageMode = "small" CardElementImageModeTiny CardElementImageMode = "tiny" )
type CardElementMarkdown ¶
type CardElementMarkdown struct {
// contains filtered or unexported fields
}
CardElementMarkdown
func NewCardElementMarkdown ¶
func NewCardElementMarkdown(content string) *CardElementMarkdown
func (*CardElementMarkdown) Content ¶
func (e *CardElementMarkdown) Content(content string) *CardElementMarkdown
func (*CardElementMarkdown) Entity ¶
func (e *CardElementMarkdown) Entity() any
func (*CardElementMarkdown) Href ¶
func (e *CardElementMarkdown) Href(defaultURL, pc, ios, android string) *CardElementMarkdown
Href 差异化跳转。仅在 PC 端、移动端需要跳转不同链接时使用
[差异化跳转]($urlVal)
func (*CardElementMarkdown) TextAlign ¶
func (e *CardElementMarkdown) TextAlign(textAlign CardElementMarkdownTextAlign) *CardElementMarkdown
TextAlign 文本内容的对齐方式
type CardElementMarkdownTextAlign ¶
type CardElementMarkdownTextAlign string
const ( CardElementMarkdownTextAlignLeft CardElementMarkdownTextAlign = "left" CardElementMarkdownTextAlignCenter CardElementMarkdownTextAlign = "center" CardElementMarkdownTextAlignRight CardElementMarkdownTextAlign = "right" )
type CardElementNote ¶
type CardElementNote struct {
// contains filtered or unexported fields
}
CardElementNote 备注
https://open.feishu.cn/document/common-capabilities/message-card/message-cards-content/notes-module
func NewCardElementNote ¶
func NewCardElementNote() *CardElementNote
func (*CardElementNote) AddElementWithImage ¶
func (e *CardElementNote) AddElementWithImage(imgKey string, preview bool, altContent string) *CardElementNote
AddElementWithImage 添加图片
preview: 点击后是否放大图片。在配置 card_link 后可设置为false,使用户点击卡片上的图片也能响应card_link链接跳转 altContent: 图片hover说明
func (*CardElementNote) AddElementWithLarkMarkdown ¶
func (e *CardElementNote) AddElementWithLarkMarkdown(s string) *CardElementNote
AddElementWithLarkMarkdown 添加文本(lark_md)
func (*CardElementNote) AddElementWithPlainText ¶
func (e *CardElementNote) AddElementWithPlainText(s string) *CardElementNote
AddElementWithPlainText 添加文本(plain_text)
func (*CardElementNote) Entity ¶
func (e *CardElementNote) Entity() any
type CardGlobalConfig ¶
type CardGlobalConfig struct {
// contains filtered or unexported fields
}
func NewCardGlobalConfig ¶
func NewCardGlobalConfig() *CardGlobalConfig
func (*CardGlobalConfig) CardLink ¶
func (gConf *CardGlobalConfig) CardLink(defaultURL, pc, ios, android string) *CardGlobalConfig
CardLink 消息卡片跳转链接
用于指定卡片整体的点击跳转链接,可以配置默认链接,也可以分别为 PC 端、Android 端、iOS 端配置不同的跳转链接
- 如果未配置 pc、ios、android,则默认跳转至 defaultURL
- 如果配置了 pc、ios、android,则优先生效各端指定的跳转链接
func (*CardGlobalConfig) ConfigEnableForward ¶
func (gConf *CardGlobalConfig) ConfigEnableForward(b bool) *CardGlobalConfig
ConfigEnableForward 是否允许转发卡片
- true:允许
- false:不允许
func (*CardGlobalConfig) ConfigUpdateMulti ¶
func (gConf *CardGlobalConfig) ConfigUpdateMulti(b bool) *CardGlobalConfig
ConfigUpdateMulti 是否为共享卡片
- true:是共享卡片,更新卡片的内容对所有收到这张卡片的人员可见
- false:非共享卡片,即独享卡片,仅操作用户可见卡片的更新内容
func (*CardGlobalConfig) HeaderIcon ¶
func (gConf *CardGlobalConfig) HeaderIcon(imgKey string) *CardGlobalConfig
HeaderIcon 标题的前缀图标
func (*CardGlobalConfig) HeaderTemplate ¶
func (gConf *CardGlobalConfig) HeaderTemplate(template CardHeaderTemplate) *CardGlobalConfig
HeaderTemplate 标题主题颜色
type CardHeaderTemplate ¶
type CardHeaderTemplate string
CardHeaderTemplate 标题样式
const ( CardHeaderTemplateBlue CardHeaderTemplate = "blue" CardHeaderTemplateWathet CardHeaderTemplate = "wathet" CardHeaderTemplateTurquoise CardHeaderTemplate = "turquoise" CardHeaderTemplateGreen CardHeaderTemplate = "green" CardHeaderTemplateYellow CardHeaderTemplate = "yellow" CardHeaderTemplateOrange CardHeaderTemplate = "orange" CardHeaderTemplateRed CardHeaderTemplate = "red" CardHeaderTemplateCarmine CardHeaderTemplate = "carmine" CardHeaderTemplateViolet CardHeaderTemplate = "violet" CardHeaderTemplatePurple CardHeaderTemplate = "purple" CardHeaderTemplateIndigo CardHeaderTemplate = "indigo" CardHeaderTemplateGrey CardHeaderTemplate = "grey" CardHeaderTemplateDefault CardHeaderTemplate = "default" )
type CardHeaderTextTag ¶
type CardHeaderTextTag struct { Content string Color CardHeaderTextTagColor }
type CardHeaderTextTagColor ¶
type CardHeaderTextTagColor string
CardHeaderTextTagColor 标签样式
const ( CardHeaderTextTagColorNeutral CardHeaderTextTagColor = "neutral" CardHeaderTextTagColorBlue CardHeaderTextTagColor = "blue" CardHeaderTextTagColorTurquoise CardHeaderTextTagColor = "turquoise" CardHeaderTextTagColorLime CardHeaderTextTagColor = "lime" CardHeaderTextTagColorOrange CardHeaderTextTagColor = "orange" CardHeaderTextTagColorViolet CardHeaderTextTagColor = "violet" CardHeaderTextTagColorIndigo CardHeaderTextTagColor = "indigo" CardHeaderTextTagColorWathet CardHeaderTextTagColor = "wathet" CardHeaderTextTagColorGreen CardHeaderTextTagColor = "green" CardHeaderTextTagColorYellow CardHeaderTextTagColor = "yellow" CardHeaderTextTagColorRed CardHeaderTextTagColor = "red" CardHeaderTextTagColorPurple CardHeaderTextTagColor = "purple" CardHeaderTextTagColorCarmine CardHeaderTextTagColor = "carmine" )
type Message ¶
type Message interface {
Apply(body *MessageBody) error
}
type MessageBody ¶
type MessageBody struct { MsgType string `json:"msg_type"` Content *MessageBodyContent `json:"content,omitempty"` Card *json.RawMessage `json:"card,omitempty"` }
type MessageBodyCard ¶
type MessageBodyCard struct { Header *json.RawMessage `json:"header,omitempty"` Elements *json.RawMessage `json:"elements,omitempty"` I18nElements *json.RawMessage `json:"i18n_elements"` Config *json.RawMessage `json:"config,omitempty"` CardLink *json.RawMessage `json:"card_link,omitempty"` }
type MessageBodyCardTemplate ¶
type MessageBodyCardTemplate struct { Type string `json:"type"` Data MessageBodyCardTemplateData `json:"data"` }
type MessageBodyCardTemplateData ¶
type MessageBodyCardTemplateData struct { TemplateID string `json:"template_id"` TemplateVariable *json.RawMessage `json:"template_variable,omitempty"` }
type MessageBodyContent ¶
type MessageBodyContent struct { Text string `json:"text,omitempty"` Post *json.RawMessage `json:"post,omitempty"` ImageKey string `json:"image_key,omitempty"` }
type RichTextBuilder ¶
type RichTextBuilder struct {
// contains filtered or unexported fields
}
func NewRichText ¶
func NewRichText(language Language, title string) *RichTextBuilder
func (*RichTextBuilder) At ¶
func (rtb *RichTextBuilder) At(id, name string) *RichTextBuilder
At @ 标签
id: 用户的 Open ID 或 User ID
@ 单个用户时,id 字段必须是有效值(仅支持 @ 自定义机器人所在群的群成员) @ 所有人时,填 all (也可以使用 RichTextBuilder.AtEveryone)
func (*RichTextBuilder) AtEveryone ¶
func (rtb *RichTextBuilder) AtEveryone() *RichTextBuilder
func (*RichTextBuilder) Hyperlink ¶
func (rtb *RichTextBuilder) Hyperlink(text, href string) *RichTextBuilder
Hyperlink 超链接标签
func (*RichTextBuilder) Image ¶
func (rtb *RichTextBuilder) Image(imgKey string) *RichTextBuilder
Image 图片标签
图片的唯一标识。可通过 上传图片 接口获取 https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/image/create
func (*RichTextBuilder) Text ¶
func (rtb *RichTextBuilder) Text(text string, unEscape bool) *RichTextBuilder
Text 文本标签
unEscape 表示是否 unescape 解码,未用到 unescape 时传入 false