Documentation
¶
Index ¶
- Variables
- func AddReaction(ctx context.Context, reactionType, msgID string) (reactionID string, err error)
- func AddReaction2DB(ctx context.Context, msgID string)
- func AddReactionAsync(ctx context.Context, reactionType, msgID string) (err error)
- func CheckFunctionEnabling(chatID string, function consts.LarkFunctionEnum) bool
- func CreateMsgText(ctx context.Context, content, msgID, chatID string) (err error)
- func CreateMsgTextRaw(ctx context.Context, content, msgID, chatID string) (err error)
- func DownImgFromMsgAsync(ctx context.Context, msgID, fileType, fileKey string) (err error)
- func DownImgFromMsgSync(ctx context.Context, msgID, fileType, fileKey string) (url string, err error)
- func GenFullLyricsCard(ctx context.Context, title, artist, leftLyrics, rightLyrics string) string
- func GenUUIDStr(str string, length int) string
- func GenerateMusicCard(imgKey, title, artist, playURL, lyrics string) string
- func GenerateMusicCardByStruct(ctx context.Context, imgKey, title, artist, playURL, lyrics, musicID string) string
- func GetAllImageFromMsgEvent(ctx context.Context, message *larkim.EventMessage) (imageKeys iter.Seq[string], err error)
- func GetAllImgTagFromMsg(ctx context.Context, message *larkim.Message) (imageKeys iter.Seq[string], err error)
- func GetAllImgURLFromMsg(ctx context.Context, msgID string) (iter.Seq[string], error)
- func GetAllImgURLFromParent(ctx context.Context, data *larkim.P2MessageReceiveV1) (iter.Seq[string], error)
- func GetAndResizePicFromURL(ctx context.Context, imageURL string) (res []byte, err error)
- func GetChatIDFromMsgID(ctx context.Context, msgID string) (chatID string, err error)
- func GetChatName(ctx context.Context, chatID string) (chatName string)
- func GetCommand(ctx context.Context, content string) (commands []string)
- func GetCommandWithMatched(ctx context.Context, content string) (commands []string, isCommand bool)
- func GetMsgByID(ctx context.Context, msgID string) string
- func GetMsgFullByID(ctx context.Context, msgID string) *larkim.GetMessageResp
- func GetMsgImages(ctx context.Context, msgID, fileKey, fileType string) (file io.Reader, err error)
- func GetRandomEmoji() string
- func GetTemplate(template database.TemplateVersion) database.TemplateVersion
- func GetTenantAccessToken(ctx context.Context) string
- func GetUserMapFromChatID(ctx context.Context, chatID string) (memberMap map[string]*larkim.ListMember, err error)
- func GetUserMemberFromChat(ctx context.Context, chatID, openID string) (member *larkim.ListMember, err error)
- func IsCommand(ctx context.Context, content string) bool
- func IsMentioned(mentions []*larkim.MentionEvent) bool
- func PreGetTextMsg(ctx context.Context, event *larkim.P2MessageReceiveV1) string
- func ReBuildArgs(argName, argValue string) string
- func RecordMessage2Opensearch(ctx context.Context, resp *larkim.CreateMessageResp, contents ...string)
- func RecordReplyMessage2Opensearch(ctx context.Context, resp *larkim.ReplyMessageResp, contents ...string)
- func RecoverMsg(ctx context.Context, msgID string)
- func RecoverMsgEvent(ctx context.Context, event *larkim.P2MessageReceiveV1)
- func RemoveReaction(ctx context.Context, reactionID, msgID string) (err error)
- func ReplyCard(ctx context.Context, cardContent *TemplateCardContent, msgID, suffix string, ...) (err error)
- func ReplyCardText(ctx context.Context, text string, msgID, suffix string, replyInThread bool) (err error)
- func ReplyCardTextGraph(ctx context.Context, text string, graph any, msgID, suffix string, ...) (err error)
- func ReplyMsgRawContentType(ctx context.Context, msgID, msgType, content, suffix string, ...) (resp *larkim.ReplyMessageResp, err error)
- func ReplyMsgText(ctx context.Context, text, msgID, suffix string, replyInThread bool) (resp *larkim.ReplyMessageResp, err error)
- func SendEphemeral(ctx context.Context, chatID, openID, card string)
- func SendRecoveredMsg(ctx context.Context, err any, msgID string)
- func TrimAtMsg(ctx context.Context, msg string) string
- func TrimLyrics(lyrics string) string
- func Upload2Lark(ctx context.Context, musicID string, bodyReader io.ReadCloser) (imgKey string, err error)
- func UploadPicAllinOne(ctx context.Context, imageURL, musicID string, uploadOSS bool) (key string, ossURL string, err error)
- func UploadPicBatch(ctx context.Context, sourceURLIDs map[string]int) chan [2]string
- func UploadPicture2Lark(ctx context.Context, URL string) (imgKey string)
- func UploadPicture2LarkReader(ctx context.Context, picture io.Reader) (imgKey string)
- type CardData
- type EphemeralCardReqBody
- type TemplateCardContent
- func (c *TemplateCardContent) AddJaegerTraceInfo(traceID string) *TemplateCardContent
- func (c *TemplateCardContent) AddVariable(key string, value interface{}) *TemplateCardContent
- func (c *TemplateCardContent) BuildTemplate() string
- func (c *TemplateCardContent) GetVariables() []string
- func (c *TemplateCardContent) String() string
- func (c *TemplateCardContent) UpdateVariables(m map[string]interface{}) *TemplateCardContent
- type TemplateStru
- type TextBuilder
Constants ¶
This section is empty.
Variables ¶
View Source
var ( FourColSheetTemplate = database.TemplateVersion{TemplateID: "AAq0LWXpn9FbS"} ThreeColSheetTemplate = database.TemplateVersion{TemplateID: "AAq0LIyUeFhNX"} TwoColSheetTemplate = database.TemplateVersion{TemplateID: "AAq0LPliGGphg"} TwoColPicTemplate = database.TemplateVersion{TemplateID: "AAq0LPJqOoh3s"} AlbumListTemplate = database.TemplateVersion{TemplateID: "AAqdqaEBaxJaf"} SingleSongDetailTemplate = database.TemplateVersion{TemplateID: "AAqdrtjg8g1s8"} FullLyricsTemplate = database.TemplateVersion{TemplateID: "AAq3mcb9ivduh"} StreamingReasonTemplate = database.TemplateVersion{TemplateID: "ONLY_SRC_STERAMING_CARD"} NormalCardReplyTemplate = database.TemplateVersion{TemplateID: "AAqRQtNPSJbsZ"} NormalCardGraphReplyTemplate = database.TemplateVersion{TemplateID: "AAqdmx3wt8mit"} )
View Source
var ( BotOpenID = "ou_8817f540f718affd21718f415b81597f" BotAppID = "cli_a570c2871fe3500e" FullLyricsCardPattern = `` /* 4127-byte string literal not displayed */ MusicCardPattern = `` /* 5460-byte string literal not displayed */ )
View Source
var LarkClient *lark.Client = lark.NewClient(env.LarkAppID, env.LarkAppSecret)
Functions ¶
func AddReaction ¶
func AddReaction2DB ¶
func AddReactionAsync ¶
func CheckFunctionEnabling ¶
func CheckFunctionEnabling(chatID string, function consts.LarkFunctionEnum) bool
func CreateMsgText ¶
CreateMsgText 不需要自行BuildText
func CreateMsgTextRaw ¶
CreateMsgTextRaw 需要自行BuildText
func DownImgFromMsgAsync ¶
DownImgFromMsgAsync 从Msg中下载附件
@param ctx context.Context @param msgID string @param fileKey string @param fileType string @return image []byte @return err error @author kevinmatthe @update 2025-04-27 20:15:38
func DownImgFromMsgSync ¶
func DownImgFromMsgSync(ctx context.Context, msgID, fileType, fileKey string) (url string, err error)
DownImgFromMsgSync 从Msg中下载附件
@param ctx context.Context @param msgID string @param fileKey string @param fileType string @return image []byte @return err error @author kevinmatthe @update 2025-04-27 20:15:38
func GenFullLyricsCard ¶
func GenUUIDStr ¶
func GenerateMusicCard ¶
func GetAllImageFromMsgEvent ¶
func GetAllImageFromMsgEvent(ctx context.Context, message *larkim.EventMessage) (imageKeys iter.Seq[string], err error)
GetAllImageFromMsgEvent 从消息事件中获取所有图片
@param event *larkim.P2MessageReceiveV1 @author kevinmatthe @update 2025-04-28 19:47:21
func GetAllImgTagFromMsg ¶
func GetAllImgTagFromMsg(ctx context.Context, message *larkim.Message) (imageKeys iter.Seq[string], err error)
GetAllImgTagFromMsg 从消息事件中获取所有图片
@param event *larkim.P2MessageReceiveV1 @author kevinmatthe @update 2025-04-28 19:47:21
func GetAllImgURLFromMsg ¶
func GetAllImgURLFromParent ¶
func GetAndResizePicFromURL ¶
func GetChatIDFromMsgID ¶
func GetCommandWithMatched ¶
func GetMsgFullByID ¶
func GetMsgFullByID(ctx context.Context, msgID string) *larkim.GetMessageResp
func GetMsgImages ¶
func GetRandomEmoji ¶
func GetRandomEmoji() string
func GetTemplate ¶
func GetTemplate(template database.TemplateVersion) database.TemplateVersion
func GetTenantAccessToken ¶
func GetUserMapFromChatID ¶
func GetUserMemberFromChat ¶
func IsMentioned ¶
func IsMentioned(mentions []*larkim.MentionEvent) bool
func PreGetTextMsg ¶
func PreGetTextMsg(ctx context.Context, event *larkim.P2MessageReceiveV1) string
PreGetTextMsg 获取消息内容
@param ctx @param event @return string
func ReBuildArgs ¶
func RecordMessage2Opensearch ¶
func RecordMessage2Opensearch(ctx context.Context, resp *larkim.CreateMessageResp, contents ...string)
func RecordReplyMessage2Opensearch ¶
func RecordReplyMessage2Opensearch(ctx context.Context, resp *larkim.ReplyMessageResp, contents ...string)
func RecoverMsg ¶
func RecoverMsgEvent ¶
func RecoverMsgEvent(ctx context.Context, event *larkim.P2MessageReceiveV1)
func RemoveReaction ¶
func ReplyCard ¶
func ReplyCard(ctx context.Context, cardContent *TemplateCardContent, msgID, suffix string, replyInThread bool) (err error)
ReplyCard 注意:不要传入已经Build过的文本
@param ctx @param text @param msgID
func ReplyCardText ¶
func ReplyCardText(ctx context.Context, text string, msgID, suffix string, replyInThread bool) (err error)
ReplyCardText 123
@param ctx @param text @param msgID
func ReplyCardTextGraph ¶
func ReplyCardTextGraph(ctx context.Context, text string, graph any, msgID, suffix string, replyInThread bool) (err error)
ReplyCardTextGraph 123
@param ctx @param text @param msgID
func ReplyMsgRawContentType ¶
func ReplyMsgText ¶
func ReplyMsgText(ctx context.Context, text, msgID, suffix string, replyInThread bool) (resp *larkim.ReplyMessageResp, err error)
ReplyMsgText ReplyMsgText 注意:不要传入已经Build过的文本
@param ctx @param text @param msgID
func SendEphemeral ¶
func TrimAtMsg ¶
TrimAtMsg trim掉at的消息
@param ctx context.Context @param msg string @return string @author heyuhengmatt @update 2024-07-17 01:39:05
func TrimLyrics ¶
func Upload2Lark ¶
func UploadPicAllinOne ¶
func UploadPicBatch ¶
Types ¶
type EphemeralCardReqBody ¶
type TemplateCardContent ¶
type TemplateCardContent struct {
Type string `json:"type"` // must be template
Data CardData `json:"data"`
}
func NewCardContent ¶
func NewCardContent(ctx context.Context, template database.TemplateVersion) *TemplateCardContent
func (*TemplateCardContent) AddJaegerTraceInfo ¶
func (c *TemplateCardContent) AddJaegerTraceInfo(traceID string) *TemplateCardContent
func (*TemplateCardContent) AddVariable ¶
func (c *TemplateCardContent) AddVariable(key string, value interface{}) *TemplateCardContent
func (*TemplateCardContent) BuildTemplate ¶
func (c *TemplateCardContent) BuildTemplate() string
func (*TemplateCardContent) GetVariables ¶
func (c *TemplateCardContent) GetVariables() []string
func (*TemplateCardContent) String ¶
func (c *TemplateCardContent) String() string
func (*TemplateCardContent) UpdateVariables ¶
func (c *TemplateCardContent) UpdateVariables(m map[string]interface{}) *TemplateCardContent
type TemplateStru ¶
type TextBuilder ¶
type TextBuilder struct {
// contains filtered or unexported fields
}
func NewTextMsgBuilder ¶
func NewTextMsgBuilder() *TextBuilder
func (*TextBuilder) AtUser ¶
func (t *TextBuilder) AtUser(userId, name string) *TextBuilder
func (*TextBuilder) Build ¶
func (t *TextBuilder) Build() string
func (*TextBuilder) Text ¶
func (t *TextBuilder) Text(text string) *TextBuilder
Source Files
¶
Click to show internal directories.
Click to hide internal directories.